Processed in your browser

JSON Key Sorter

Create deterministic, readable JSON while preserving array order. Recursive mode sorts objects inside arrays but never reorders the array items themselves.

Processed in your browser
0 / 1,000,000
Sorted JSON

Tool guide

What is JSON Key Sorter?

JSON Key Sorter creates stable object layouts that are easier to compare and review. It can sort only top-level keys or recursively sort nested objects while always preserving array element order. This reduces noisy diffs without treating arrays as unordered sets or changing data types. Common workflows include the following. Normalize configuration and snapshot-test object order. Reduce key-order noise in Git diffs. Arrange API examples so related fields are easier to find. The page also documents input boundaries, output behavior, and practical cautions so you can review the result before putting it into an application, configuration, test, or production workflow.

When to use it

  • Normalize configuration and snapshot-test object order.
  • Reduce key-order noise in Git diffs.
  • Arrange API examples so related fields are easier to find.

How to use it

  1. Paste valid JSON.
  2. Choose whether nested objects should also be sorted.
  3. Sort and copy the result.
  4. Load one of the realistic examples first to verify the selected options and processing direction before replacing it with your own data.
  5. Review the output, status message, and documented limits; copy, download, or continue only after the result matches your expectation.

Runnable examples

The “Example 1” and “Example 2” buttons load the matching inputs. They cover different structures, directions, or boundaries and can be run directly in the workspace.

Example 1

{"z":1,"profile":{"updated":"2026-08-09","name":"JSONLane","features":[{"status":"ready","id":2},{"id":1,"status":"done"}]},"a":2}

Example 2

{"settings":{"theme":"dark","language":"en","editor":{"wrap":true,"indent":2}},"build":20,"adsense":"reviewed"}

Input rules

  • Input must be valid JSON.
  • Recursive sorting affects object keys only, not array order.
  • Duplicate keys and unsafe integers follow the warnings shown by the page.
  • Text input is counted before processing and is limited to 1,000,000 characters on this page; file modes apply the separate file limit shown in the workspace.
  • Sorting uses stable English key ordering.

Output rules

  • Object keys use a stable English sorting rule.
  • Output is indented and preserves data types.
  • Objects inside arrays may be sorted, but array elements never move.
  • Output reflects only the current input, direction, and options; rerun after changing a mode or value instead of treating an earlier result as current.
  • Unsafe integers are rejected.

Limitations and cautions

  • Sorting uses stable English key ordering.
  • Unsafe integers are rejected.
  • Comments and trailing commas are not valid JSON.

How your data is handled

Sorting is performed through local parsing and serialization; the document is not submitted to a server.

FAQ

Are arrays sorted?

No. Array item order is preserved; only object keys are sorted.

How are duplicate keys handled?

A warning is shown and the standard parser keeps the last value.

Why are large integers refused?

This prevents silent precision changes during parsing and serialization.

Does recursive sorting change array order?

No. It may sort keys inside objects that are array items, but the array items remain in their original positions.

Will key sorting make any two JSON documents equal?

No. It removes key-order noise only; array order, types, values, and missing fields still matter.

Is the order identical to a database collation?

Not necessarily. This page uses a stable text order, while databases may apply different locale and case rules.

Updated: 2026-07-31