Sort JSON keys alphabetically for clean diffs
Recursively sort all object keys in JSON structures in ascending or descending alphabetical order.
About This Tool
JSON Key Alphabetical Sorter organizes JSON object keys alphabetically at every nesting level, making configuration files and API snapshots easy to compare and version control in Git.
Key Features
Deep recursive key sorting
A-Z and Z-A sorting order options
Customizable JSON formatting indentation
Instant syntax validation and copy
How to Use This Tool
- Paste your JSON document in the input editor.
- Choose Ascending (A-Z) or Descending (Z-A) order.
- Select 2 spaces or 4 spaces indentation.
- Click Sort JSON Keys and copy the formatted result.
Why Use This Tool
- Eliminates noisy git diffs caused by disordered object keys.
- Maintains clean and predictable schema configurations.
- Recursively sorts nested objects and arrays of objects.
Pro Tips
- Run your package.json or i18n translation files through this tool to maintain clean alphabetical keys
- Sorted keys make comparing two JSON API payloads significantly faster
Frequently Asked Questions
Are nested objects inside arrays also sorted?
Yes, the sorter traverses all nested objects, arrays, and sub-objects recursively.
Are array item orders modified?
Array element order is preserved; only key/value pairs within objects are sorted alphabetically.