JSON Key Sorter

Sort JSON object keys recursively in ascending or descending order, optionally sort arrays, and preserve your formatting indent.

Private by architecture: All processing is 100% client-side memory. Your data never leaves this browser tab.
JSON input
0 lines · 0 charsJSON
Sorted JSON output
0 lines · 0 chars

About This Tool

Recursively sorts every object in a JSON document so diffs between API payloads, locale files, and configuration manifests stay clean and deterministic.

In addition to object keys, you can optionally sort arrays of primitives (numbers, strings, booleans) or sort arrays of objects by a chosen property key while preserving your original indentation.

Key Features

  • Recursive key sorting: Sorts keys at every nesting depth in ascending (A to Z) or descending (Z to A) order.
  • Case sensitivity toggle: Sort using strict ASCII/Unicode code points or fold uppercase and lowercase letters together.
  • Primitive & object array sorting: Keep array order untouched by default, or sort primitive arrays and object arrays by a target key.
  • Indentation preservation: Automatically detects 2-space, 4-space, or tab indentation from your input, or formats to a fixed indent.

Frequently Asked Questions

Does sorting JSON keys change the meaning of my JSON?
In RFC 8259, JSON object member order is unordered, so sorting keys does not change semantics. Array order is meaningful in JSON, which is why array sorting is disabled by default unless you turn it on.
How does sorting an array of objects by key work?
When Array sorting is set to Object arrays or Both and you enter a key name (such as id or name), any array whose elements are all objects is sorted by that property value.
How is indentation preserved?
When Indent is set to Preserve, the sorter inspects the first indented line of your input to detect tab characters or the space count, and applies that same indent to the sorted output.
Is my JSON uploaded anywhere?
No. Parsing and sorting execute locally in your browser with zero network calls.