JSON Sort Keys Formatter & Minifier

Sort JSON keys alphabetically (recursively), then format or minify. This tool beautifies and minifies JSON Sort Keys on one page — paste your code, pick a mode, and click. Everything runs on your device, nothing is sent to a server.

The result will appear here…
or press Ctrl+Enter

Everything runs in your browser. Your code is never sent to our servers.

728 × 90Ad Space AvailablePlace your ad here

Example

Example Input

{"b":2,"a":1}

Example Output

{
  "a": 1,
  "b": 2
}

How to Use

  1. 1Choose Format or Minify mode at the top.
  2. 2Paste your JSON Sort Keys code into the Input field.
  3. 3If needed, set the indent width in "More settings".
  4. 4Click the button (or press Ctrl+Enter) to process. The result appears in the Output field.
  5. 5Click Copy to copy the result.

About the JSON Sort Keys Formatter

JSON Sort Keys sorts all JSON object keys alphabetically, including nested objects, then displays it prettified (Format) or compacted (Minify).

How it works: the tool parses the JSON, recursively sorts each object's keys, then rewrites it. Array element order is preserved (only object keys are sorted).

Sorting keys is useful for stable diffs across versions, config normalization, and making it easier to compare two JSON documents that should be equivalent.

FAQ

Can this JSON Sort Keys tool both format and minify?

Yes. One page with a toggle — Format mode prettifies (beautifies) with indentation, and Minify mode compacts it. No need for two separate pages.

Is my code sent to a server?

No. JSON Sort Keys is processed entirely in your browser using JavaScript/WebAssembly. Your code never leaves your device.

Related Tools

Related Categories