Make JSON comparable. The normalizer sorts every object's keys, removes repeated array entries and pretty-prints the result, so two exports that only differ in ordering come out identical — ready for a clean diff, a stable cache key or a tidy commit. Drop many files to normalize them together.
| Input | Normalized |
|---|---|
| {"b":1,"a":2} | {"a":2,"b":1} |
| [{"x":1,"y":2},{"y":2,"x":1}] | [{"x":1,"y":2}] |
Key order doesn't change JSON's meaning but creates noise in diffs.
By deep equality — same content, regardless of key order.
No. Only key order and duplicate array entries change.
Only when order doesn't matter, which is why it's optional.
No.
The JSON is rebuilt recursively. Object keys are sorted by code point (as most canonical-JSON schemes do), or case-insensitively if you prefer. Arrays are deduplicated by deep equality: each item is turned into a canonical string with sorted keys, so objects with the same content in a different key order count as duplicates, and the first occurrence is kept. Optionally, arrays containing only plain values are sorted — numbers numerically, everything else as text. This is off by default because order often matters. The output can be pretty-printed or minified. Number and string values are never altered.