{
"dependencies": {
"Axios": "^1.6.0",
"lodash": "^4.17.21",
"react": "^19.0.0"
},
"keywords": [
"json",
"Format",
"tools"
],
"name": "devtools",
"scripts": {
"build": "vite build",
"Dev": "vite",
"test": "vitest"
},
"version": "1.0.0"
}Tips
- Deep sorts every nested object's keys; Shallow only sorts the top level.
- Use case-insensitive + natural order for stable, human-friendly diffs in
package.jsonand config files. - Array order is preserved by default (often semantic) — turn on “Sort array values” only when order doesn't matter.
About JSON Sort Keys
JSON Sort Keys reorders the keys of an object alphabetically. Pick deep to sort recursively at every nesting level, or shallow to sort only the top-level keys. Optional natural sort treats embedded numbers correctly so `item2` appears before `item10`. The values are preserved exactly; only the order of keys changes — which matters because most tools that compare JSON treat key order as significant when reading textual output.
This is the canonical preparation step before diffing two JSON documents that started in different orders, hashing a config to produce a stable cache key, or comparing two API responses for content equality. Without sorted keys, two semantically identical documents can be reported as different by a textual diff. Note that JSON arrays are ordered — Sort Keys does not touch array element order. For objects-inside-arrays, deep sort still rearranges the inner object's keys but keeps the array order intact.
Examples
{"name":"Ada","born":1815,"id":42}{"born":1815,"id":42,"name":"Ada"}Top-level keys alphabetised. Deep mode would also sort keys inside any nested object.
Frequently asked questions
Does it sort array elements?
No. Arrays are ordered by definition; reordering them would change the meaning of the document. Sort Keys only reorders object keys.
What is the difference between deep and shallow?
Shallow sorts only the keys at the top level. Deep recurses into every nested object and sorts those keys too. Use shallow if you only care about the surface order; use deep before any structural comparison or hashing.
How is this different from Sort Lines?
Sort Lines reorders lines of text without parsing them. Sort Keys parses the JSON, reorders keys, and re-emits valid JSON. The result is structurally equivalent to the input — same values, just in a deterministic order.
Can I sort in descending order?
Yes — flip the order toggle. Both deep and shallow modes support ascending and descending; natural sort applies in either direction.
