Switch frontend to use json helper (#73874)

This commit is contained in:
J. Nick Koston
2022-06-23 13:19:13 -05:00
committed by GitHub
parent 3d59088a62
commit edb386c736
3 changed files with 25 additions and 3 deletions

View File

@ -87,6 +87,15 @@ def json_dumps(data: Any) -> str:
).decode("utf-8")
def json_dumps_sorted(data: Any) -> str:
"""Dump json string with keys sorted."""
return orjson.dumps(
data,
option=orjson.OPT_NON_STR_KEYS | orjson.OPT_SORT_KEYS,
default=json_encoder_default,
).decode("utf-8")
json_loads = orjson.loads