The brackets are behaving. Pick an action above.
Coming later: JSON to TypeScript and JSON to YAML. One bracket adventure at a time.
Paste a payload, tidy it up, check what broke, or squeeze it onto one line. Your JSON never leaves this page.
The brackets are behaving. Pick an action above.
Coming later: JSON to TypeScript and JSON to YAML. One bracket adventure at a time.
JSON Toolkit treats the browser's own parser as the authority, then adds useful presentation around it.
Live validation produces either a parsed value or a structured error. Format, minify, and sort reuse that result instead of parsing independently and disagreeing.
Sorting walks the entire value recursively, but only alphabetizes object keys. Arrays retain their original order because changing it could change the data itself.
Parser positions are translated into line and column numbers, then paired with the offending line. It is much nicer than a red box that only says invalid.
if (Array.isArray(value)) return value.map(sortKeys);
if (value && typeof value === "object") {
return Object.fromEntries(
Object.entries(value)
.sort(([a], [b]) => a.localeCompare(b))
.map(([key, child]) => [key, sortKeys(child)])
);
}const before = input.slice(0, position);
const line = before.split("\n").length;
const column = position - before.lastIndexOf("\n");