snaptools
A↓
JSON Sort Keys error
⌃⏎ run · clear · / focus input
// about this tool

JSON Sort Keys Online

Updated 2026-07-09

Sort JSON object keys alphabetically online for free. Paste JSON and SnapTools reorders every object's keys recursively — A→Z or Z→A — while keeping array order and values untouched, ready to copy or download. Everything runs in your browser, so nothing is uploaded.

A consistent key order turns noisy JSON diffs into clean ones, makes two API responses easy to compare, and gives you canonical output for caching or hashing. Drop your JSON here and get a normalised version in one step.

// how to use

  1. 1 Paste your JSON into the input panel.
  2. 2 SnapTools sorts every object's keys recursively as you type.
  3. 3 Choose A→Z or Z→A, then copy or download the normalised JSON.

// examples

Sort keys alphabetically
Input
{"banana":1,"apple":2}
Output
{"apple":2,"banana":1}

// common uses

Producing clean, stable JSON diffs in Git Comparing two JSON objects field by field Normalising config files for consistency Generating canonical JSON for caching or hashing

// faq

Yes. Keys are sorted recursively at every level of the structure, so deeply nested objects come out fully ordered.
Array order is preserved — sorting arrays would change your data. Only object keys are reordered; objects inside an array are still key-sorted.
A consistent key order makes JSON diffs in Git far cleaner, helps compare two API responses, and produces canonical output for caching or hashing.
No. Only the order of object keys changes; every value, type, and array stays exactly as it was.
No — sorting happens in your browser, so nothing leaves your machine.

Use this via API

Get a free API key →
curl -X POST https://snaptools.dev/api/v1/tools/json-sort-keys \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"json":"{\"banana\":1,\"apple\":2}"}'
Esc
↑↓ navigate open Esc close