Spaces:
Sleeping
Sleeping
Download app/common/json_utils.py from TheJackBright/polyguard-openenv: direct link, hf CLI and curl.
- Browser
- Download file 297 Bytes
-
https://huggingface.co/spaces/TheJackBright/polyguard-openenv/resolve/main/app/common/json_utils.py
- Command line
-
hf download hf://spaces/TheJackBright/polyguard-openenv/app/common/json_utils.py
-
curl -L -o json_utils.py https://huggingface.co/spaces/TheJackBright/polyguard-openenv/resolve/main/app/common/json_utils.py
297 Bytes
| """Strict JSON helpers.""" | |
| from __future__ import annotations | |
| import json | |
| from typing import Any | |
| def safe_json_dumps(payload: Any) -> str: | |
| return json.dumps(payload, ensure_ascii=True, sort_keys=True, default=str) | |
| def safe_json_loads(payload: str) -> Any: | |
| return json.loads(payload) | |