python-kasa/kasa/json.py
J. Nick Koston 2d42ca301f
Use orjson when already installed or with speedups extra (#466)
* Use orjson when already installed

* Use orjson when already installed

* fix patch target

* fix patch target

* add speedups extra

* Update README.md

* Update README.md
2023-06-18 01:03:04 +02:00

16 lines
262 B
Python
Executable File

"""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