TFT

JSON Sorter – Sort JSON Keys & Values

Sort JSON by key name (A→Z / Z→A) or by any key's value. Select a specific key from the dropdown to sort arrays of objects by that field. Works recursively at all nesting levels.

Key A→Z

Sort every object's keys in ascending alphabetical order — recursively at all nesting levels.

Key Z→A

Sort every object's keys in descending alphabetical order — works on nested objects too.

Value ↑

Sort array items by a selected key's value in ascending order. Numbers and strings both supported.

Value ↓

Sort array items by a selected key's value in descending order. Numeric comparison used when possible.

Examples

Sort by Key (A→Z)

Before

{
  "zebra": 1,
  "apple": 2,
  "mango": 3
}

After

{
  "apple": 2,
  "mango": 3,
  "zebra": 1
}

Sort by Value (age ↑)

Before

[
  {"name":"Bob","age":35},
  {"name":"Alice","age":22}
]

After

[
  {"name":"Alice","age":22},
  {"name":"Bob","age":35}
]

About JSON Sorter

JSON object key order doesn't affect parsing but matters for readability and diff comparison. This tool sorts JSON keys alphabetically at all nesting levels, or sorts JSON arrays by any key's value. Consistent key ordering makes version control diffs cleaner and data comparison easier.

Sort by Key Name

Choose Key A→Z or Key Z→A to reorder every object's properties alphabetically. This works recursively — every nested object at every depth gets sorted. Array items are not reordered (arrays are inherently ordered by position).

Sort by Value

Choose Value ↑ or Value ↓, then pick a key from the dropdown. The tool finds all arrays of objects and sorts them by the selected key's value. Numeric keys sort numerically; string keys sort lexicographically. The key dropdown is auto-populated from your JSON — just paste your data and all available keys appear instantly.

Questions

Does sorting affect data meaning?

No. JSON objects are unordered by specification. Sorting only changes presentation. Values are never modified.

Are arrays sorted by key sort?

No. Key sort reorders properties within objects only. Array element order is always preserved. Value sort specifically reorders array items.

How does value sort work for nested arrays?

It recurses through all nested structures. Any array of objects at any nesting level gets sorted by the selected key.

What if my value is a number vs string?

Numeric values are compared as numbers. Strings are compared lexicographically. Mixed types fall back to string comparison.

Why don't I see keys in the dropdown?

Paste valid JSON first. The dropdown is populated automatically once your JSON is parsed successfully.