JSON formatter and validator
Format, minify, validate — and when it is not valid, the fix has a name and a line.
What you get
- Formats the 765 b minified sample into 54 lines — two spaces per level, keys in their order
- Minifies the 54-line order back to one line of 765 b
- Validates: “Valid JSON”, or every problem by line with the fix’s name — and Fix all, then format, in one click
- Copies or downloads the result; opens the same text in the app for the tree, undo and the rest
What it will not do
- Reorder keys, sort anything or change a value. Formatting is whitespace; the numbers and strings are the ones you pasted.
- Upload the text. The engine runs in your tab; nothing is sent.
- Guess at broken JSON silently. A broken document gets the verdict and the list, and formats only after you press Fix all.
What each button does
- Format
{"a":1,"b":[1,2]}{ "a": 1, "b": [ 1, 2 ] }Two spaces per level; the keys stay in the order the text has them.
- Minify
{ "a": 1 }{"a":1}Every space and line break outside a string goes.
- Validate
The verdict, and each problem by line with the fix’s name. Fix all rewrites only those lines; the app’s ⌘Z puts them back.
- A number is a number
Formatting rewrites whitespace, never a value: 1.50 stays 1.50, a 64-bit id stays what it was.
The sample
What the first sample opens — a real file, not an illustration written for this page.
in VS Code
Format Document is VS Code’s own; the extension adds the verdict to the status bar and the named fixes to the lightbulb.
Questions
What indent does it use?
Two spaces per level — the app’s convert indent. Keys keep the order the text has them in.
Does it change numbers?
No. Formatting rewrites whitespace between tokens and nothing else; 1.50 stays 1.50 and a long id stays intact.
What happens when the JSON is not valid?
The verdict says what is wrong — “Not valid JSON yet · N fixable” — and lists each problem by line with the fix’s name. Fix all rewrites those lines, then formats.
Is it a linter?
It reports what the parser and the fix pipeline find: quotes, commas, literals, brackets. It does not check a schema.