What is a JSON Sorter?
A JSON sorter reorders the keys of a JSON object into alphabetical order and re-serialises the result. The values are untouched; only the order in which the keys appear changes, so {"name":"toolz","author":"Liton"} becomes {"author":"Liton","name":"toolz"}. Sorting is recursive by default, which means the keys inside every nested object are sorted too, all the way down.
Key order does not change what a JSON document means, because objects are defined as unordered collections of name-value pairs in the JSON standard, ECMA-404. But order matters a great deal to the humans and tools that read the text. A predictable, alphabetical order makes a config file easy to scan, keeps two files comparable, and produces stable diffs: when every export sorts its keys the same way, a version-control diff shows only the values that changed instead of noise from keys that merely moved.
This tool gives you control over how the sort runs. You can sort ascending (A to Z) or descending (Z to A), fold case so Name and name sit together, and choose whether to descend into nested objects or sort only the top level. Array order is preserved by default, because arrays are ordered by definition and reordering them can change meaning, but an option will sort arrays whose elements are all strings or all numbers when you do want them ordered. You can pretty-print the output with two-space, four-space, or tab indentation, or minify it to a single line.
Everything happens in your browser. The JSON is parsed, sorted, and re-serialised in JavaScript on your own machine, and nothing is uploaded, logged, or stored. That keeps API responses, configuration files, and payloads containing tokens or personal data on your device, and it means the tool keeps working offline once the page has loaded.
How to use the JSON Sorter?
Paste your JSON
Paste a JSON object or array into the input box, or load the sample. The input must be valid JSON; parse errors are reported with the exact position so you can fix them.
Choose the sort order
Pick ascending or descending, decide whether to ignore case, and choose whether to sort recursively through nested objects or only the top-level keys.
Set the output style
Pretty-print with two-space, four-space, or tab indentation, or minify to a single line. Optionally sort arrays of strings or numbers as well as object keys.
Copy or download the result
Run the sort, then copy the reordered JSON to your clipboard or download it as a .json file. The key count confirms how many keys were reordered.
Key Features
Recursive key sorting
Sort the keys of every nested object, not just the top level, so a deeply nested config comes out in a fully predictable order from top to bottom.
Ascending or descending
Order keys A to Z or Z to A, with optional case-insensitive comparison so Name and name are grouped together instead of split by capitalisation.
Optional array sorting
Arrays keep their order by default. Turn on array sorting to also order arrays whose elements are all strings or all numbers, leaving mixed arrays untouched.
Stable, diff-friendly output
Consistent alphabetical order means version-control diffs show only changed values, not keys that merely moved, which keeps code review focused.
Frequently Asked Questions
Related Tools
JSON Flattener
Flatten nested JSON into single-level dot-notation keys, or unflatten dotted keys back into nested objects and arrays. Lossless round trip. 100% client-side.
JSON to Go Struct
Convert JSON into Go struct definitions with json tags. Nested objects become inline structs, arrays of objects are merged, and field names follow Go conventions. Runs client-side.
JSON to YAML Converter
Convert JSON to clean, valid YAML instantly - configurable indentation and safe string quoting
JSON Validator
Validate JSON against RFC 8259 and get the exact line, column, and character of the first syntax error, plus duplicate-key detection and structure stats. Client-side, no signup.
Comments
0 comments
No comments yet. Be the first to share your thoughts!