What this tool does
The JSON Validator & Formatter takes any JSON snippet — an API response, a config file, a message from a logging pipeline — and gives you instant feedback on whether it parses, where it breaks if it doesn't, and how to make it look the way you want. It uses CodeMirror with the official @codemirror/lang-json linter for inline errors, and JSON.parse + JSON.stringify for fast, exact formatting and minification.
Everything runs locally in your browser. No accounts, no upload, no logging. Useful for API development, configuration review, debugging, code reviews, snapshot diffing and learning JSON.
Why people use it
- Debugging API responses — paste curl output, see exactly which character the parser tripped on.
- Reviewing config files —
package.json,tsconfig.json, Prettier and ESLint configs. - Stable diffs in pull requests — sort keys before committing to keep diffs minimal.
- Embedding JSON in markup — minify before pasting into HTML or SQL string literals.
- Learning JSON syntax — try the broken sample to see common gotchas highlighted.
- Inspecting structure — instant counts of keys, objects, arrays and depth.
How to use it
- Paste your JSON into the editor — or click Paste to pull from your clipboard, or Sample to load a starter snippet.
- Read diagnostics. Errors are underlined in red with a tooltip on hover; the status badge above the editor shows the message, line and column.
- Format, minify or sort. Once it parses, the buttons under the editor unlock — pick the indent that fits your codebase or minify for production.
- Copy. Use the Copy button to send the current editor contents to your clipboard. Stats below show size, lines, depth, keys, objects and arrays.
Format vs. Minify vs. Sort Keys
- • Format (2 spaces) — the most common style for source-controlled config files; matches
package.jsonandtsconfig.jsondefaults. - • Format (4 spaces) — easier to read for deeply nested data; matches Python-style indentation preferences.
- • Minify — strips every whitespace character; the right output for HTTP payloads, JWT claims and embedded blobs.
- • Sort Keys — recursively alphabetises every object's keys, then re-emits with 2-space indent. Great for deterministic diffs and reproducible snapshots.
Common JSON mistakes the linter catches
{ name: "Ada" } — JSON requires every key to be a double-quoted string.{ 'name': 'Ada' } — JSON only accepts double quotes around strings.["a", "b",] — JSON forbids a comma after the last item.// or /* */ — JSON has no comments. Use JSONC if you need them.\n, \t, \\.} or ] — common after pasting two snippets.Privacy
Validation, formatting, minification and stats all run client-side: JSON.parse and CodeMirror's linter operate in-browser, and the editor contents stay in component state until you copy or close the tab. Nothing is sent to a server, stored in cookies or written to local storage.