Skip to main content
NeatUtility

JSON Key Sorter & Alphabetizer

JSON & Data100% Client-Side
Ready
JSON
0 lines0 chars
0 B / 4.77 MB
About this tool, examples & FAQ

Sort and alphabetize keys in JSON documents for clean diffs, deterministic hashes, and human readability. Supports ascending/descending order, deep recursive sorting, and array element ordering.

Key facts

Verified capabilities and limits of this utility
Sorting CapabilitiesAscending (A-Z), Descending (Z-A), and deep recursive ordering
Array HandlingOptional sorting of primitive array values (numbers and strings)
Maximum Input5 MB
Execution Deadline3 s

How to use

  1. Paste your JSON document into the input editor.
  2. Choose your sort direction: Ascending (A → Z) or Descending (Z → A).
  3. Toggle recursive sorting, case sensitivity, or array element sorting as needed.
  4. Click Sort Keys (or press Ctrl/Cmd + Enter) to produce sorted canonical JSON.
  5. Copy, download, or Send To another developer utility like Text Diff.

Example

Alphabetize JSON Keys

Input

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

Example output

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

Edge cases

Semantic invariance

According to the JSON standard (RFC 8259), object key ordering is not semantically significant. Reordering keys produces an equivalent JSON object that is easier to inspect and diff.

Recursive vs shallow sorting

When 'Deep / Recursive' is enabled, keys inside nested objects and objects inside arrays are also sorted recursively.

Array preservation

Arrays represent ordered sequences. Array sorting is disabled by default to preserve list semantics, and can be optionally enabled for primitive values.

How it works

  1. Parses the input string into a structured JavaScript object graph.
  2. Recursively traverses keys and sorts them according to the configured collation and order.
  3. Reconstructs objects with ordered keys and re-serializes with chosen indentation.
  4. Operates entirely client-side in a Web Worker without uploading data.

Frequently asked questions

Why should I sort JSON keys before running a diff?

Different serializers output keys in arbitrary or creation order. Alphabetizing keys normalizes the document structure, eliminating noisy false differences during code reviews and API contract comparisons.

Does sorting keys create Canonical JSON?

Sorting object keys alphabetically is a primary requirement for deterministic and Canonical JSON generation (such as RFC 8785) used in hashing and digital signatures.

Is my JSON sent to an external server?

No. All parsing and sorting is performed directly in your web browser via isolated Web Workers. Nothing is transmitted over the internet.

References