Paste JSON to begin.

What this tool does

JSON Sorter alphabetizes object keys recursively. That means nested objects are also normalized, which reduces visual noise when two payloads contain the same data in different key orders.

Sorting is helpful when JSON comes from different services or serializers that output properties in different sequences.

Common use cases

  • Preparing payloads for cleaner diffs in pull requests.
  • Normalizing fixture files before committing them.
  • Comparing API responses from different environments.
  • Making deeply nested objects easier to scan.

Input and output example

Before

{"b":2,"a":{"d":4,"c":3}}

After

{
  "a": {
    "c": 3,
    "d": 4
  },
  "b": 2
}

How to use this tool

  1. Paste valid JSON into the input panel.
  2. Click Sort JSON Keys.
  3. Copy or download the normalized result.
  4. Use JSON Diff after sorting both payloads if you want an easier comparison workflow.
Your JSON is processed in your browser and is not uploaded to our servers.

Common errors

  • Invalid JSON must be fixed before sorting can happen.
  • Arrays keep their order, so sorting affects object keys, not list positions.
  • If downstream logic depends on display order, review before replacing a file.
  • Copied JavaScript objects with unquoted keys are not valid JSON input.

Related tools

FAQ

Does sorting affect arrays?

No. Arrays keep their original order. Only object keys are sorted.

Can I use this before diffing two files?

Yes. Sorting both sides first often makes comparisons much easier.

Will key sorting change the data itself?

No. It only changes object key order in the output.

Can I upload a JSON file?

Yes. Upload a local file, sort it, and download the result.