How to Use JSON Sort Keys: Steps and a Worked Example

By 1 min read

Sort the keys of a JSON object alphabetically, including nested objects, for clean diffs. This guide shows what to enter, a worked example, and the limits to keep in mind. The JSON Sort Keys tool is free, needs no account and runs in your browser.

What you need

  • JSON

Step by step

  1. Open the JSON Sort Keys tool.
  2. Fill in JSON.
  3. Read the result, which updates as soon as the inputs change.

Worked example

the tool returns:

{
  "active": true,
  "address": {
    "city": "New York",
    "zip": "10001"
  },
  "id": 42,
  "name": "InovoTools"

How it works

Paste a JSON object. Keys are sorted A to Z at every level and the result is pretty-printed.

Things to keep in mind

Check your inputs, units and any local rules before you rely on the result.

If this is not quite what you need, try JSON Object Keys Extractor, JSON Formatter or JSON Validator.

More from the blog