Skip to content

Commit

Permalink
fix: use json.loads directly in be_json
Browse files Browse the repository at this point in the history
  • Loading branch information
kod-kristoff committed Dec 9, 2024
1 parent fb84c4c commit dd6b281
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/json_arrays/jsonlib/backends/be_json.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"""Json backend using standard `json` lib."""

import json
from typing import Any, Union


def dumps(obj, **kwargs) -> bytes:
return json.dumps(obj, separators=(",", ":"), ensure_ascii=False, **kwargs).encode("utf-8")


def loads(s: Union[bytes, bytearray, str], **kwargs) -> Any:
return json.loads(s.decode("utf-8") if isinstance(s, (bytes, bytearray)) else s, **kwargs)
loads = json.loads

0 comments on commit dd6b281

Please sign in to comment.