Research-Stack/4-Infrastructure/shim/utils/json_utils.py
allaun 5f80fd8429 chore(repo): push local 768-commit branch state onto clean remote baseline
This squashes all local history (768 commits) onto the scrubbed PR #90
baseline. Individual commits were lost during filter-repo corruption;
the working tree content is preserved intact.

Build: N/A (working tree state only)
2026-06-15 22:46:50 -05:00

19 lines
565 B
Python

import json
from pathlib import Path
from typing import Any
def stable_json(obj: Any) -> str:
return json.dumps(obj, sort_keys=True, separators=(",", ":"), ensure_ascii=True)
def canonical_json_bytes(obj: Any) -> bytes:
return json.dumps(obj, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode()
def load_json(path: Path) -> Any:
return json.loads(path.read_text(encoding="utf-8"))
def load_jsonl(path: Path) -> list:
return [json.loads(line) for line in path.read_text(encoding="utf-8").strip().splitlines() if line.strip()]