Sort object keys for predictable diffs.
Section: Pretty-printing
Pretty-print with sorted keys
bash
bash
python - <<'PY'
import json
from pathlib import Path
p = Path('data.json')
obj = json.loads(p.read_text())
print(json.dumps(obj, indent=2, sort_keys=True))
PYExplanation
Stable key order is useful in reviews and version control.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Pretty-printing