Code tool

Sort JSON

Paste JSON to format it consistently, alphabetize nested object keys, and choose whether arrays keep their order or sort by value.

In-browser processingNo account requiredPrivacy details ↗

Standard JSON only, up to 2 MB. Keys are sorted recursively.

Paste JSON to begin.

A QUICK WALKTHROUGH

How to use this tool

  1. Paste valid JSON up to 2 MB into the editor.
  2. Choose recursive key sorting, array order, compact output, and indentation.
  3. Format the result, then copy or download the normalized JSON.

Predictable recursive sorting

Every JSON object is rebuilt with keys in locale-independent lexicographic order. Nested objects follow the same rule, so the result is stable and easy to compare in code review or generated files.

Arrays stay meaningful by default

Array order is preserved unless you explicitly enable array sorting. When enabled, primitive values sort predictably and nested values use their compact JSON representation; mixed or object-heavy arrays may be easier to read with order preserved.

Local processing and clear limits

Parsing and formatting happen in your browser. Input is limited to 2 MB to keep the page responsive, and JSON values remain JSON values: comments, trailing commas, NaN, and Infinity are invalid.

GOOD TO KNOW

Common questions

Does sorting change array order?

No. Arrays keep their order by default. Turn on Sort arrays when you deliberately want array values reordered.

Are object keys sorted at every depth?

Yes. The tool recursively sorts keys inside objects nested in objects and arrays.

Can it format JSON with comments or trailing commas?

No. It accepts standard JSON only. Remove comments and trailing commas before formatting.

Is my JSON uploaded?

No. Parsing, sorting, formatting, copying, and downloading run locally in your browser.