mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 11:13:34 +00:00
16 lines
262 B
Python
16 lines
262 B
Python
|
"""JSON abstraction."""
|
||
|
|
||
|
try:
|
||
|
import orjson
|
||
|
|
||
|
def dumps(obj, *, default=None):
|
||
|
"""Dump JSON."""
|
||
|
return orjson.dumps(obj).decode()
|
||
|
|
||
|
loads = orjson.loads
|
||
|
except ImportError:
|
||
|
import json
|
||
|
|
||
|
dumps = json.dumps
|
||
|
loads = json.loads
|