Ordenador de Chaves JSON

Ordene as chaves de objetos JSON alfabeticamente, por comprimento ou em ordem reversa — com suporte recursivo para objetos aninhados

Ordem de Classificação
Recuo
Entrada JSON
Saída Ordenada

Ordenador de Chaves JSON

Ordene as chaves de objetos JSON alfabeticamente, por comprimento ou em ordem reversa — com suporte recursivo para objetos aninhados

Recursos

  • 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

Como usar

  1. Cole o JSON no painel de entrada.
  2. Escolha a ordem de classificação e as opções.
  3. Clique em Ordenar Chaves.
  4. Copie o resultado ordenado.

Dicas e Melhores Práticas

  • 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.

Perguntas Frequentes

Por que ordenar as chaves JSON?

Ordenar as chaves facilita a comparação de JSON, a revisão em PRs e a manutenção da consistência nos arquivos de configuração.

Os valores são modificados?

Não, apenas a ordem das chaves muda. Todos os valores, arrays e tipos de dados permanecem intactos.