Sort JSON object keys recursively while preserving array order.
The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.
Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.
Objects are traversed and their own keys sorted lexicographically in ascending or descending order, while arrays retain their original element order. The result is serialized with the chosen indentation.
{"zebra": 1, "apple": 2, "mango": 3}
{
"apple": 2,
"mango": 3,
"zebra": 1
}
Config normalization, snapshot tests, and signing preparation sort object members.