# JSON Key Sorter

URL: https://phishdestroy.io/developer-tools/json-key-sorter
Category: General dev
Where it runs: Runs locally (nothing you enter is uploaded)

Sort the keys of every object in a JSON document, at every depth, while arrays keep their order. Normalising two API or RDAP responses this way makes a diff show only real changes.

## Example input

RDAP-style record

```
{"status":"active","ldhName":"login.example.com","Registrar":"Example Registrar","events":[{"eventDate":"2026-10-01T00:00:00Z","eventAction":"registration"}]}
```

Keys come out as Registrar, events, ldhName, status, with eventAction before eventDate inside the array item; capital letters sort before lowercase.

## FAQ

### What exactly is sorted?

The keys of every object at every level, including objects inside arrays; the order of array items never changes. The result is printed with 2-space indentation.

### Why is the order not what I expected?

Keys are compared by UTF-16 code units, not alphabetically by locale, so uppercase sorts before lowercase and item10 before item9. Keys that look like array indexes ("9", "10") always come first in numeric order, because that is how JavaScript objects store them.

### Is the JSON uploaded?

No. Sorting runs in your browser and nothing is sent.

## Related tools

- [JSON Diff](https://phishdestroy.io/developer-tools/json-diff)
- [JSON Formatter](https://phishdestroy.io/developer-tools/json-formatter)
- [Text Diff Viewer](https://phishdestroy.io/developer-tools/text-diff)
- [JSONPath Evaluator (Dot Notation)](https://phishdestroy.io/developer-tools/jsonpath-evaluator)
- [JSON Minifier](https://phishdestroy.io/developer-tools/json-minifier)

All tools: https://phishdestroy.io/developer-tools
