JSON Key Sorter
Put the keys of every object in order so two versions of the same document can be read side by side.
关于此工具
Sorting keys is what makes two versions of a document comparable. Configuration written by hand and configuration written by a program hold the same data in a different order, and a text diff on the pair is unreadable until both sides are sorted the same way. Only object keys move here. An array is left exactly as it was, because the order of an array is part of the data, and a tool that quietly sorted arrays as well would change what a document means while claiming to tidy it. Comparison is by code unit by default, which puts capitals before lower case and 10 before 2. The option to read digit runs as numbers fixes the second of those, and is written out here rather than handed to the browser, since a comparison that follows the page language would sort the same file differently in each of this site four languages. Duplicate keys survive as duplicates, side by side.
使用方法
- Paste your JSON into the input pane, or load the sample.
- Choose the order and the indent width, then press Sort keys.
- Copy the result or download it as a file.