JSON Validator
Paste JSON below to check whether it's valid and pretty-print it. Everything runs locally in your browser — nothing is uploaded.
New to this? Read the JSON Validator guide →
Formatted JSON will appear here.
Paste some JSON and press Validate & format.
How to use the JSON validator
- Paste or type your JSON into the input box (or press Load sample to see an example).
- Press Validate & format. If the JSON is valid, the output pane shows it re-indented; if not, the status line names the first error and where it is.
- Pick your indentation (2 spaces, 4 spaces or a tab) and press Copy to grab the formatted result.
Everything happens in your browser using the built-in JSON.parse, so even large or sensitive payloads (API responses, config files, tokens) never leave your device.
What makes JSON valid
JSON looks like a JavaScript object literal but the rules are stricter. Valid JSON requires all of the following:
- Double quotes everywhere. Keys and string values must use "double quotes", never single quotes or backticks.
- No trailing commas. The comma after the last item in an object or array ([1, 2, 3,]) is invalid, even though JavaScript allows it.
- No comments. // and /* */ are not part of JSON.
- Quoted keys. Every object key must be a quoted string: {"id": 1}, not {id: 1}.
- A single root value. The document is one object, array, string, number, boolean or null. Numbers cannot have leading zeros or a trailing dot, and NaN and Infinity are not allowed.
Errors it catches, with fixes
- {'name': 'Sam'} → swap the single quotes for double quotes: {"name": "Sam"}.
- {"a": 1,} → remove the trailing comma: {"a": 1}.
- {name: "Sam"} → quote the key: {"name": "Sam"}.
- A pasted file that starts with an invisible byte-order mark (BOM) or smart quotes from a word processor will fail; retype the quotes or strip the BOM.
When to reach for it
Use it to debug an API response that your code rejects, to pretty-print a minified blob so you can read it, to sanity-check a hand-edited config or package.json before committing, or to confirm that data copied from a log is well-formed. If a parse error has you stuck, the error position points straight at the character that broke it.
Where you'd use this
The first thing to reach for when an API returns "unexpected token" and no line number. A validator points at the exact character, which is usually a trailing comma, a single quote, or an unescaped newline inside a string.
For example: A webhook payload is rejected by your endpoint. The validator flags position 412: a trailing comma after the last element of an array — legal in JavaScript, illegal in JSON, and invisible when you are scanning 400 lines by eye.
Frequently asked questions
What does the JSON validator check?
It parses your JSON and reports the first syntax error with its location — missing or trailing commas, unquoted keys, mismatched brackets and similar. Valid JSON is also pretty-printed.
What is the difference between validating and formatting?
Validating confirms your JSON is syntactically correct; formatting re-indents it for readability. This tool does both — it flags errors and formats valid input.
Is my JSON uploaded?
No. Parsing and formatting happen locally in your browser, so you can safely paste sensitive payloads.