Developer Tools
JSON Formatter & Validator
Format, minify and validate JSON with clear error messages, copy and download options.
Paste JSON above and choose an action.
What is a JSON formatter and validator?
JSON (JavaScript Object Notation) is the data format behind nearly every API, config file, and modern web app — but hand-written or machine-generated JSON is often a single unreadable line, or subtly invalid. A JSON formatter parses your JSON and reprints it with clean indentation, a minifier strips it to the smallest valid form, and a validator tells you exactly what is wrong when parsing fails. This tool does all three in your browser, with precise error messages that include the position of the problem.
How to use this tool
- Paste your JSON into the input box — from an API response, a config file, or anywhere else.
- Press Format for readable 2-space indentation, Minify for the most compact valid form, or Validate to check correctness without changing anything.
- If the JSON is invalid, read the error message — it names the problem and its position so you can fix it.
- Use Copy output or Download .json to take the result with you.
Key features
- Three actions: pretty-print with 2-space indent, minify to one line, and validate-only checks.
- Precise error reporting using the browser's native JSON parser messages, including error position.
- Validation summary describing the top-level type (object, array, string, number) and its size.
- One-click copy with a textarea fallback for older browsers, plus .json file download.
- Everything runs locally — API keys and private data in your JSON never leave your device.
Common use cases
- API debugging: pasting a response to read its structure or find a misplaced comma.
- Config files: checking package.json, tsconfig, or settings files before saving.
- Payload size: minifying JSON before embedding it in a page or sending it over the wire.
- Learning: seeing how nested objects and arrays are structured when formatted.
- Data pipelines: validating JSONL-style payloads one object at a time before import.
Practical tips
- The most common JSON errors are trailing commas, single quotes instead of double quotes, and unquoted keys — the error position points straight at them.
- JSON has no comments; strip them before validating, or the parser will reject the input.
- Minified JSON is for machines, formatted JSON is for humans — keep both: edit the formatted version, deploy the minified one.
- Very large payloads (tens of megabytes) can freeze the tab; validate big files in chunks.
- When an API returns invalid JSON, validate the raw response here before blaming your code.
Frequently Asked Questions
What does 'Unexpected token at position N' mean?
The parser found a character it did not expect at that character position — usually a trailing comma, a missing quote, or a stray bracket. Count to that position in your input to find the culprit.
Why does my JSON fail when it looks fine?
Common invisible causes: single quotes instead of double quotes, unquoted object keys, trailing commas, comments, or a BOM character at the start of the file. Paste it here and the error message will pinpoint the issue.
What is the difference between Format and Minify?
Format adds indentation and line breaks for human readability; Minify removes all unnecessary whitespace to produce the smallest valid JSON. Both represent exactly the same data.
Can JSON contain comments?
No — the JSON specification does not allow comments, and strict parsers reject them. Some tools accept JSONC or JSON5, but plain JSON must be comment-free.
Is my JSON data sent to a server?
No. Parsing, formatting, and validation all happen locally in your browser using its built-in JSON engine, so sensitive payloads stay on your device.