TR

Home / Web & Developer / JSON Key Sorter

🔤 JSON Key Sorter

JSON Key Sorter – get instant, free results right on your device.

WhatsAppTelegramX

Keys of nested objects are sorted too; the order of arrays does not change. This is useful when comparing JSON files in version control. Not an official institution.

Last updated: November 2026 · Parameter year: 2026 · Methods and sources: Methodology · Editorial policy

What is JSON Key Sorter?

Key order in JSON objects carries no meaning, but in version control (git), changes in order produce unnecessary diffs. Sorting keys alphabetically makes it easier to compare files and two structures, and it also keeps configuration files tidy.

Paste your JSON, choose the sort order A → Z or Z → A, and set the indentation (2 spaces, 4 spaces, or a single line). The tool also sorts the keys of nested objects. For example, the input {"z":1,"a":2} comes back as {"a":2,"z":1}. The single-line option also minifies the JSON.

The order of items inside arrays is not changed, because order matters in arrays. An error is shown if invalid JSON is entered. The data is not sent to a server; it is processed in the browser. You can also use the JSON Formatter / Minifier tool for validation and indentation.

How to use

Fill in these fields: Sorting, Indentation, JSON. Then press the button; the result appears on the same page and your data never leaves your device.

Formula

{"b":1,"a":2} → {"a":2,"b":1}

Example

{"b":1,"a":2} → {"a":2,"b":1}

Worked examples and tips

Example 1: You run the data {"z":1,"b":{"y":2,"a":3},"a":[{"d":1,"c":2}]} with A → Z and 2-space indentation. In the output the root keys fall in the order a, b, z; inside b, a comes first and y second; and in the object inside the a array, the order c, d is applied too. Sorting is applied to all nested levels.

Example 2: When you run the data {"b":1,"a":2,"c":3} with Z → A and Single line (minify), the result is {"c":3,"b":1,"a":2}. This form, with no spaces or line breaks, suits storing as a configuration string.

Example 3: If you process the text {"yas":30,"ad":"Ali"} with A → Z and 4 spaces, the ad key comes before yas, and each line is indented with four spaces: first "ad": "Ali" is written, then "yas": 30.

Tips and common mistakes: Sorting is by key name; array items do not change places, they are only reordered inside objects. Always saving JSON files that go into version control in the same order prevents unnecessary change lines. Some systems (for example, those that compute signatures) are sensitive to key order; if you will use the data in such a place after sorting, check the expected order.

When is it used? To bring two JSON files into the same layout before comparing them, or to keep files in a repository tidy.

Frequently asked questions

JSON Key Sorter – how to use it?

Fill in the fields and press the button; the result appears instantly. Example: {"b":1,"a":2} → {"a":2,"b":1}

JSON Key Sorter – is it free, and is my data stored?

Yes, it is free and requires no sign-up. Because processing happens in your browser, the information you enter is not sent to a server.

Related tools

🧩Base64 Encode/DecodeEncode text to Base64 or decode it from Base64 (UTF-8 supported).{ }JSON Formatter / MinifierValidate, neatly format, or minify JSON.🔗URL Encode/DecodeEncode text to be URL-safe, or decode encoded text.#️⃣SHA Hash Generator (SHA-1/256/384/512)SHA Hash Generator (SHA-1/256/384/512) – get instant, free results right on your device.🪪JWT DecoderJWT Decoder – get instant, free results right on your device.🔍Regex TesterRegex Tester – get instant, free results right on your device.