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. Pega el JSON en el panel de entrada.
  2. Elige el orden de clasificación y las opciones.
  3. Haz clic en Ordenar Claves.
  4. Copia el resultado ordenado.

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

¿Por qué ordenar las claves JSON?

Ordenar las claves facilita la comparación de JSON, la revisión en PRs y mantener la consistencia en los archivos de configuración.

¿Modifica los valores?

No, solo cambia el orden de las claves. Todos los valores, arrays y tipos de datos permanecen intactos.