🔤

JSON Key Sorter

Software · 3 inputs · Free

🔤

JSON Key Sorter

3 inputs

Parameters

What is this tool?

JSON Key Sorter helps developers with encoding, encryption and text processing. Sorts the keys of JSON objects alphabetically at every level; array order and values stay untouched, and numbers are kept exactly as written. Sorting does not depend on the locale: keys are compared by UTF-16 code units (as in RFC 8785 JCS), so uppercase letters come before lowercase ones.

📘 Common mistakes · Worked example
JSONOrderIndentation

Sorts the keys of JSON objects alphabetically at every level; array order and values stay untouched, and numbers are kept exactly as written. Sorting does not depend on the locale: keys are compared by UTF-16 code units (as in RFC 8785 JCS), so uppercase letters come before lowercase ones.

The result is not exact or binding and is for information only; it is not an official document and cannot be used in official procedures. Confirm it with the competent authority or a professional before acting; no liability is accepted for losses arising from its use.

Last reviewed: · Methodology and sources

How is it calculated?

Sorts the keys of JSON objects alphabetically at every level; array order and values stay untouched, and numbers are kept exactly as written. Sorting does not depend on the locale: keys are compared by UTF-16 code units (as in RFC 8785 JCS), so uppercase letters come before lowercase ones.

Inputs

ValueUnitExample
JSON—{"name":"Ada","id":1,"tags":["b","a"],"address":{"zip":"10115","city":"Berlin"}}
Order—A → Z
Indentation—2 spaces

What is this tool?

JSON Key Sorter helps developers with encoding, encryption and text processing. Sorts the keys of JSON objects alphabetically at every level; array order and values stay untouched, and numbers are kept exactly as written. Sorting does not depend on the locale: keys are compared by UTF-16 code units (as in RFC 8785 JCS), so uppercase letters come before lowercase ones.

Common mistakes

  • Expecting arrays to be sorted too. The tool sorts object keys only; ["b","a"] stays as it is, because changing the order of an array changes the data.
  • Expecting dictionary order. The comparison goes by code value: Zeta comes before alpha, and keys starting with letters such as é, ö or ñ are sorted after z.
  • Expecting numeric keys in numeric order. "10" and "9" are compared as text and "10" comes first; if you need numeric order, pad the keys with leading zeros ("09", "10").
  • Treating sorted output as canonical JSON and signing it. The tool does not change how numbers are written, so a signature produced according to RFC 8785 may fail to verify.
  • Producing the two documents you want to compare with different indentation options. Indentation changes the bytes; use the same option on both sides before comparing hashes or text.
  • Assuming duplicate keys are preserved. When a key occurs twice in the same object, only its last value is written to the output; the earlier ones are lost.
  • Sorting a file in which people rely on a particular key order. JSON says order is insignificant, but some tools and readers are used to a certain layout; do not reorder shared files without agreeing on it with your team.

📘 Sorting JSON Keys: Alphabetical Order, Canonical JSON and Signatures →

Sources

Key terms

JSONOrderIndentation

Frequently Asked Questions

+JSON Key Sorter — how is it calculated?

Sorts the keys of JSON objects alphabetically at every level; array order and values stay untouched, and numbers are kept exactly as written. Sorting does not depend on the locale: keys are compared by UTF-16 code units (as in RFC 8785 JCS), so uppercase letters come before lowercase ones.

+Which values are required?

JSON, Order, Indentation.

+Is my data stored?

No. All calculations run in your browser; the values you enter are never sent to or stored on a server. If you press “Save”, the calculation stays only in your own browser and you can delete it at any time.

+Is it free?

Yes, all tools are free and require no sign-up.

Similar tools

Popular Tools

🧮

Free Calculators in One Place

Tax, finance, health, math and more — 500+ tools, all in one place.

Choose your cookie preference to continue

Records the site needs to work (theme, language, favourites) stay in your browser.

This site is free and funded by ads.

With your consent, Google Analytics cookies measure visits and Google AdSense cookies are used to show ads; the data is processed on Google servers abroad.

If you reject, the site works just the same.

Cookie Policy · KVKK notice