JSON Sort — Sort JSON Keys and Arrays Online
Normalize key order and sort arrays for stable diffs, canonical fixtures, and readable configs. Choose alphabetical, natural, or numeric order — all processing stays in your browser.
Developer notes
• Sorting runs automatically as you type, paste, upload, load a sample, or change options (short debounce on input; option changes debounced ~250 ms). • Sorting parses JSON first — fix syntax errors or use JSON repair. • Default scope is `both`; choose `objectsOnly` when you only need key canonicalization for git diffs (array options reset to Preserve order). • Natural sort orders `item2` before `item10`. • Array `byObjectKey` requires a field name; objects missing the field sort last. • Mixed-type arrays sort by typeof order, then value — see unit tests for the exact order. • `maxDepth` skips sorting at and below the limit for each branch. • Options are not saved between sessions (aligned with other JSON tools). • For byte reduction after sorting, use JSON minifier.
JSON sort options
When teams pick this route
• Normalize API snapshots before JSON Diff in CI. • Canonicalize OpenAPI/JSON Schema examples for review. • Sort user lists by `name` or `id` for display fixtures. • Prepare stable golden files for Jest snapshot tests.
Worked examples
Canonical keys for diff
Before
After
Sort array of objects by name
Before
After
Navigate related JSON tools
Browse the JSON tools hub. Compare sorted output in JSON diff, prettify without reordering in the JSON formatter, validate with the JSON validator, or explore structure in the JSON tree viewer.
JSON sort FAQ
Ordering, arrays, and privacy
How is this different from the JSON formatter?
The formatter adds indentation and optional basic key sorting. JSON Sort is dedicated to reordering keys and arrays with full control over mode, direction, depth, and array behavior.
Does sorting change values?
No — only the order of object keys and array elements changes. Scalar values and nested content stay the same.
Is array order preserved by default?
Array elements keep their input order while Array sort mode is Preserve order (the default). Reorder arrays by switching to By value or By object key, or set scope to Arrays only / Objects and arrays with a non-preserve array mode.
Do I need to click a Sort button?
No. Sorted output updates automatically as you edit JSON or change options (with a short debounce while typing).
Natural vs alphabetical sort?
Natural sort treats embedded numbers correctly — `item2` sorts before `item10`. Alphabetical uses plain lexicographic order.
When should I use max depth?
Use `maxDepth: 1` to sort only top-level keys while leaving nested objects exactly as pasted — useful for partial normalization.
Is my JSON uploaded to a server?
No. Parsing, sorting, and formatting run entirely in your browser.
JSON Tools
Validate, format, diff and explore JSON payloads — complementary to minifiers and converters.
Explore other tool categories
Minify
Shrink code and assets for production — minify JavaScript, CSS, HTML, JSON and XML before gzip or CDN deploy.
Beautify
Make code readable with consistent indentation — beautify JavaScript, CSS, TypeScript, SCSS, LESS, Markdown, GraphQL, SQL, YAML and more in your browser.
Unminify
Expand minified or compressed code — unminify JavaScript, CSS, TypeScript, SCSS, LESS, SQL, YAML and other formats when debugging or reviewing.
Conversion
Transform data between JSON, YAML, XML and CSV locally — no server uploads.
CSS preprocessors
Compile SCSS or LESS to standard CSS in the browser — pair with beautify or minify for a full stylesheet workflow.
SVG Tools
Preview, optimize with SVGO, export Data URI, resize, beautify, convert to JSX and validate SVG — all in your browser.
DevOps & Infra
Terraform HCL format/validate/minify, Dockerfile format & lint, Docker Compose and .env validation.
CI/CD
GitHub Actions and GitLab CI — format YAML and check workflow/job structure in your browser.
Logs & observability
Line-oriented JSON/NDJSON and Nginx/Apache access logs — format, filter, validate, and CSV/TSV.
Kubernetes
Multi-doc manifests, structural validate, Ingress/Deployment starters, and Helm values formatting.
Networking / IP
CIDR, subnets, and IPv4/IPv6 helpers — in your browser.
Security & tokens
JWKS, X.509 certificates, and secrets scan — browser-local.
API & schemas
OpenAPI tools to format, validate, and lint your specs.
Encoding
Encode or decode Base64, URL components and HTML entities — client-side only.
Developer utilities
Timestamps, UUID, ULID, Nanoid, cron, passwords, regex, slugify, number bases, case, text diff, and chmod — all client-side.
Text & Markdown
Count words, build Markdown TOCs, and clean line lists — all in your browser.
Serialization
Serialize and deserialize PHP data structures beside JSON workflows.