mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 03:33:35 +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
|