JSON Key Sorter

Sort JSON object keys alphabetically, by length, or in reverse — with recursive nested object support

Sort Order
Indent
JSON Input
Sorted Output

JSON Key Sorter

Sort JSON object keys alphabetically, by length, or in reverse — with recursive nested object support

Features

  • Recursively sort JSON keys alphabetically (or only top-level if recursion is off)
  • Toggleable recursive mode
  • Pretty-printed output with 2-space indent
  • Stats: total keys, depth
  • Runs entirely in your browser

How to use

  1. Вставте JSON у панель введення.
  2. Оберіть порядок сортування та параметри.
  3. Натисніть «Сортувати ключі».
  4. Скопіюйте відсортований результат.

Tips & Best Practices

  • Sorted JSON gives stable diffs — useful for committing JSON config files where the original order is arbitrary.
  • Arrays are left in their original order (JSON arrays are sequences, not sets — order is semantic).
  • For deterministic JSON output across languages, JSON Canonical Form (RFC 8785) goes further than alpha-sorting; use a library for that.
  • For very large JSON, the parse+stringify round-trip is fine but memory-bound — files >100 MB may stress the browser.
  • Mixed-type arrays (objects + primitives) sort the object members internally; the array itself stays in order.

FAQ

Навіщо сортувати ключі JSON?

Сортування ключів спрощує порівняння JSON, перевірку в PR та забезпечує узгодженість конфігураційних файлів.

Чи змінюються значення?

Ні, змінюється лише порядок ключів. Усі значення, масиви та типи даних залишаються без змін.