JSON Sorter

Sort JSON keys alphabetically

Input JSON

Sort options

Off by default. When on, arrays that contain only strings, numbers, booleans or null are sorted (null, booleans, numbers, then strings). Arrays that contain objects or arrays keep their order.

Limits: 5 MiB per file or 5,242,880 characters, 256 nesting levels.

Sorted JSON

Keys are sorted recursively. Values, exact number tokens and array order are kept unless you turn on array sorting.

What JSON Sorter does

JSON Sorter reorders object keys alphabetically at every nesting level so configuration files, fixtures and API samples have a deterministic shape. Stable key order keeps Git diffs small and makes two JSON documents easier to compare. Values are never rewritten: strings keep their escapes and numbers keep their exact original tokens, including integers larger than JavaScript can represent.

How to use
  1. 1.Paste or type JSON, upload a .json file, or drop a file onto the editor.
  2. 2.Pick the key order, letter-case rule, indentation and preset.
  3. 3.The sorted result updates as you type; syntax errors show the line and column.
  4. 4.Copy the output or download it as a .json file. Clear empties the editor and Reset options restores the defaults.
Options and presets
  • •Ascending or descending key order, compared by Unicode code unit.
  • •Ignore case folds letters before comparing, so "Name" and "name" sit together; exact ties fall back to code-unit order.
  • •Indentation: 2 spaces, 4 spaces, tabs or compact single-line output.
  • •package.json and tsconfig.json presets put conventional top-level keys first (for example name, version, scripts, dependencies, or extends, compilerOptions, include) and sort everything else.
  • •Sort arrays of values is off by default. When on, arrays containing only strings, numbers, booleans or null are ordered null → booleans → numbers → strings; arrays that contain objects or arrays keep their order.
Limits and behaviour

Input is limited to 5 MiB (5,242,880 characters) and 256 nesting levels. Malformed JSON is never repaired: comments, trailing commas and single quotes are reported as errors. Duplicate keys are kept in their original relative order. Sorting runs entirely in your browser.

CodingTool is officially live on

Launched on StartupBaseCodingTool.dev - Free, Fast & Easy Developer Tools in One Place | Product HuntCodingTool - Featured on Startup FameFazier badgeListed on Turbo0Featured on Twelve ToolsFeatured on Findly.tools