JSON Sort Keys Online – Alphabetize JSON

Local only

Sort JSON object keys alphabetically at every level while preserving values and array order.

Indent

71 chars · 4 lines

Two-way sync · Edit either side and the other updates automatically.

Valid JSON
2 keys1 arrays1 objects3 depth71 chars

JSON key sorting guide

How to sort JSON keys

Paste valid JSON into the tool above to alphabetize object keys from A to Z. Sorting applies recursively to nested objects, including objects inside arrays, while values and array item order remain unchanged. Processing stays in your browser.

Steps

  1. Paste JSON or import a text-based .json file.
  2. Confirm Format view and the Sort keys switch are enabled.
  3. Review the recursively alphabetized object properties in the output.
  4. Copy or download the normalized JSON document.

Recursive object key sorting

Every JSON object is sorted independently, starting at the root and continuing through nested objects. Objects contained in arrays are sorted as well, so the result uses a consistent property order throughout the document.

The sorter compares key text in ascending code-point order. Enabling Unicode decoding also makes literal Unicode escape sequences participate using their decoded display values.

What sorting preserves

Sorting changes object property order only. String, number, boolean, and null values are preserved, and array items remain in their original sequence because array order is part of the data model.

  • Nested objects are sorted at every depth.
  • Array elements are never reordered.
  • Duplicate object keys cannot be preserved after standard JSON parsing.

Normalize JSON for review and comparison

A predictable key order makes configuration files, API examples, fixtures, and generated payloads easier to scan. It can also reduce noisy text differences before comparing two documents whose values are otherwise equivalent.

Validation, sorting, formatting, imports, and downloads run locally in the browser, so sensitive payloads are not submitted to a sorting service.

JSON key sorting example

Keys are alphabetized in the root object and nested profile object, while the roles array keeps its original order.

Unsorted JSON

{
  "z": 1,
  "profile": {
    "name": "Ada",
    "active": true
  },
  "roles": ["editor", "admin"],
  "a": 2
}

Sorted JSON

{
  "a": 2,
  "profile": {
    "active": true,
    "name": "Ada"
  },
  "roles": [
    "editor",
    "admin"
  ],
  "z": 1
}

Common questions

Frequently asked questions

Does sorting JSON keys change the values?

No. The sorter changes object property order only. Parsed values and array item order remain unchanged.

Are nested JSON objects sorted too?

Yes. Object keys are alphabetized recursively at every level, including objects stored inside arrays.

Does the tool sort JSON arrays?

No. Array order is preserved because changing element positions could change the meaning of the data.

Is my JSON uploaded while sorting?

No. Validation, sorting, formatting, and file handling run locally in your browser.