DataFormatter

JSON Validator

Validate JSON online and find syntax errors fast. Paste your JSON into the live tool below — invalid documents get a clear message plus the exact line and column of the problem.

About this tool

What is it?
DataFormatter JSON Validator is a free online validator that checks JSON against RFC 8259 and points to the exact line and column of any syntax error.
Who is it for?
Developers debugging malformed API responses, config files or webhook payloads that fail to parse.
What makes DataFormatter's tool different?
It reports precise line and column positions and runs fully client-side, so sensitive JSON never leaves your browser.

Input

Paste or type JSON, Base64, or plain text…

Paste or click a sample above — it will be detected automatically.

Quick start

  1. Paste the JSON you suspect into the editor above.
  2. A green status means valid; errors appear with line and column.
  3. Click the error line to jump straight to the broken character.

What JSON validation catches

The validator checks that your document conforms to the JSON grammar defined in RFC 8259. The most common failures it reports are:

  • Trailing commas after the last element of an object or array
  • Single quotes instead of double quotes around keys and strings
  • Unquoted or wrongly quoted object keys
  • Undefined values such as NaN, Infinity or bare undefined
  • Missing brackets or braces, and data after the closing root token

How to check JSON syntax online

  • Paste your JSON into the editor above.
  • Valid JSON is confirmed instantly; the content is left untouched.
  • Invalid JSON produces an error message with line and column.
  • Once fixed, switch tools to format or minify the result.
Invalid JSON
{
  "name": "John",
  "age": 30,
}
Validation report
Invalid JSON — Line 4, Column 1: Expected double-quoted property name in JSON at position 33 (line 4 column 1)

Who validates JSON — and when

Catching bad responses early

Before wiring an endpoint into code, paste its response here. If this page flags invalid JSON, no amount of client-side parsing will save you.

Pre-flight for config files

One trailing comma in a deployment manifest can fail an entire pipeline. Validate the file as part of writing it, not after CI breaks.

Teaching & learning JSON

The precise line-and-column feedback turns every mistake into a small, fixable lesson about the grammar.

Frequent validation errors

Unexpected token '<', "<html>…" is not valid JSON

Why: You pasted HTML (often an error page) instead of JSON — the response body started with a tag like <html>. This is the message modern Chrome/V8 reports since Chrome 123.

Fix: Check the request actually returned JSON; an API Client will show status codes and headers so you can see redirects or 500 pages.

JSON Parse error: Unexpected token '<'

Why: The same HTML-instead-of-JSON situation, reported by Safari/WebKit — the message names the token at the failure point without a position number.

Fix: Confirm the endpoint's content type is application/json and that it isn't serving a login page or error document.

JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data

Why: Firefox's phrasing of a structure error — usually a missing quote on a key, a stray comma, or an extra closing brace just before the reported position.

Fix: Read the reported line and column, then look one character before it: most structure errors come from a missing comma or an unclosed key.

Unexpected end of JSON input

Why: The document stops mid-structure: an unclosed brace, bracket, or string literal cut short by a newline.

Fix: Re-copy the complete payload; the missing closer is usually the last character that got lost in transit.

Bad escaped character in JSON

Why: A backslash followed by something JSON doesn't allow, such as \x41 or a raw Windows path like C:\new\test with unescaped backslashes.

Fix: Double every literal backslash (\\) or replace single backslashes with forward slashes in paths.

Validation glossary

Well-formed JSON
Text that parses successfully under RFC 8259: correct quoting, balanced structure, allowed value types and no trailing tokens. Validity says nothing about meaning — a well-formed document can still contain wrong data.

Pro tips

  • Validate, then format: once the status turns green, switch to the formatter to make the document reviewable.
  • The editor's bracket matching highlights paired braces — park your cursor next to one to find its partner.
  • Large payloads? Code folding collapses sections so you can scan the top-level shape first.
  • Everything is checked locally, so validating customer data or internal payloads leaks nothing.

Frequently asked questions

What does the JSON validator check?

It parses your input against the JSON grammar (RFC 8259): matching braces and brackets, quoted keys, valid value types, no trailing commas, and no stray characters after the top-level value.

My JSON is reported invalid — where is the error?

The status line shows the error message with the exact line and column. Click it to jump the editor straight to the offending character.

Does validation change or upload my JSON?

No to both. Validation only reads your input, and everything runs locally in your browser — nothing is sent to any server.

Is my JSON valid if JavaScript's eval accepts it?

Not necessarily. JSON forbids single quotes, unquoted keys, trailing commas, comments and NaN — constructs that lenient JavaScript parsing may accept.

How do I fix 'Unexpected token' errors quickly?

Read the reported position, then look one character before it — most token errors come from a missing comma, an unclosed quote or an extra bracket immediately prior. The formatter can also re-indent the document so structural mistakes become visible.

Can it validate JSON inside a larger string, like a log line?

Auto Detect looks for JSON-shaped content in what you paste, but for mixed text it's best to extract the object first (from the first { to the matching }) and validate that on its own.

Related tools