TEXT & DEVELOPER / FREE BROWSER TOOL

Sort JSON keys

Sort object keys recursively in a JSON document.

Files are processed in this browser and are not uploaded to YYY Tools.Details
Opening workspace

About Sort JSON keys

Sort JSON keys online to make configurations easier to inspect and compare. The tool can sort nested JSON object keys recursively while preserving array item order. It parses and reserializes the document, so the result is not a byte-preserving transformation.

How to alphabetize JSON object keys

  1. Paste a valid JSON document.
  2. Select Process to recursively sort object properties.
  3. Inspect the 2-space-indented result and download sorted.json.

A practical example

Input
{"z":2,"a":{"d":4,"b":1}}
Result
{
  "a": {
    "b": 1,
    "d": 4
  },
  "z": 2
}

Nested objects are sorted too; values inside an array retain their original positions.

Supported input and limitations

  • Array elements are not sorted. Integer-like property names follow JavaScript enumeration rules.
  • Key comparison is locale-aware, not a cryptographic canonical JSON standard. Do not use this output as a canonical signing format.

Processing happens on your device. Read about local processing and optional workspace recovery.

Frequently asked questions

Does sorting JSON keys change array order?

No. Arrays preserve their item order, while object keys inside their items are processed recursively.

Can I use sorted JSON for digital signatures?

Do not rely on this tool for canonicalization. Signing protocols require a precisely specified serialization, numeric representation, and key ordering.

Related tools