Input

Waiting for a document to check.

Validation Results

Paste JSON on the left. Checking starts on its own once you have paused typing for 300 ms.

What a JSON validator actually tells you

You ran a deploy, the service came up, and one request came back with SyntaxError: Expected double-quoted property name in JSON at position 35. That message is accurate and nearly useless, because position 35 is a character offset into the whole document and your editor counts in lines. Paste the same text here and you get Line 3, Column 3, a sentence that names the actual mistake (here, a key wrapped in single quotes where JSON wants double ones), and underneath it the exact sentence your own browser's JSON.parse throws, so you can still match it against the one in your logs. Click the position and the cursor lands on the offending quote.

Worth knowing before you use any validator: "valid JSON" is a wider category than most people assume. RFC 8259 §2 says a JSON text is any value, so "Reykjavik", 123, true and null are each complete documents on their own: you do not need an object or an array at the top. Several validators get that wrong and report a bare string as broken. This one does not, and it also peels a second layer when a document turns out to be a stringified document, which is what "{\"qci\":9}" is and what you get when something in the chain called stringify twice. The grammar behind all of this is short enough to read in one sitting on json.org.

How to use it

  1. Paste, upload or type – Put the document in the left pane. "Paste" pulls text from your clipboard after the browser asks for permission once (refuse, and the keyboard shortcut inside the pane does the same job), and "Upload" opens a .json or .txt file. Nothing is sent anywhere: the check runs in the page.
  2. Read the verdict – Checking runs about 300 ms after your last keystroke, so there is no button. The strip under the editor gives the short answer (for the Sample: "Valid JSON · object with 2 keys · 421 B"); the right panel adds size, lines, depth and total keys, or, for a broken document, the line, the column and two explanations.
  3. Jump to the fault – The failing line gets an amber band and a gutter marker. Click "Line 3, Column 3" in the panel, or the amber strip under the editor, and the cursor is placed on the exact character, ready for you to fix it.
  4. Fix, then look again – A parser stops at the first fault, so one error does not mean one problem. Correct it and the check re-runs, and if a second fault existed, it appears now with its own position.
  5. Tidy the result – Once the document parses, Format re-indents it at two spaces and Minify puts it on one line. Both rewrite the pane in place and keep every number as you typed it. Turn on "Sort keys A to Z" first and both put every object's keys in alphabetical order. With "Full screen" on, the editor and the results take over the browser window until you press Esc.

One thing that catches people out: for a trailing comma, Chrome's JSON.parse blames the closing brace on the next line (line 6 column 1 in the worked example below), because that is where it ran out of patience. The position this page reports is the comma itself, Line 5, Column 22, which is the character you actually need to delete.

A worked example

This is the document behind the Invalid Sample button, so you can click it and compare. It carries two separate faults, a single-quoted key on line 3 and a trailing comma on line 5, and the panel reports exactly one of them, because that is where the parser stopped. The right-hand card is what the panel shows in Chrome; Firefox and Safari word the browser line differently.

Two faults → one error Validate
session.jsonInvalid · 2 faults
{
  "subscriberId": "SUB-77821",
  'apn': "internet.mno.com",
  "qci": 9,
  "pdpType": "IPv4v6",
}
Validation Resultsfirst fault only
⚠ Invalid JSON

Line 3, Column 3
Error: Strings and property names need
double quotes, not single quotes.
Your browser's JSON.parse says:
Expected double-quoted property name in
JSON at position 35 (line 3 column 3)

The trailing comma on line 5 is not
mentioned. Fix line 3 and it becomes:

Line 5, Column 22
Error: Trailing comma. JSON does not
allow a comma before } or ].
Your browser's JSON.parse says:
Expected double-quoted property name in
JSON at position 97 (line 6 column 1)

When you would reach for this

Turning a byte offset into a line number

Node, Python and Go all report the offset differently and none of them is a line number. Node says at position 35, Python's json.decoder.JSONDecodeError says char 35 alongside a line and column, and Go's encoding/json reports offset 35 with no line at all. Pasting the payload here normalises the three into one answer. It is also the fastest way to check whether the offset in the log even matches the file you are looking at, if the document is shorter than the offset, you are debugging the wrong copy.

Confirming a config file before it ships

A malformed tsconfig.json, package.json or ESLint config fails at start-up, often with a message from a wrapper rather than the parser. Check it here first. One caveat that costs people an afternoon: tsconfig.json and VS Code's settings files are JSON with Comments, not JSON, a // line is legal there and will be reported as an error here. That is the validator being right about JSON, not wrong about your file.

Sanity-checking a payload that carries long identifiers

Telecom and finance payloads are full of 18- and 19-digit values: an ICCID such as 8901240544102066246, a card BIN, a Snowflake ID. Most validators parse into JavaScript numbers to inspect the document, which quietly rounds that to 8901240544102066000; you would not see it here anyway, but it means the size and key counts they print describe a document you did not paste. This page keeps the digits as written, which is the same care the JSON Formatter and JSON to Table take. MDN's JSON.parse reference spells out where the limit comes from.

What the panel shows

  • Line and column, not an offset – the parser's character position is resolved against your text before it is shown.
  • Two explanations, not one – a plain sentence naming the mistake, and below it your browser's own JSON.parse message exactly as it throws it, so it matches what your terminal printed. Only Firefox's JSON.parse: prefix is trimmed.
  • The failing line is tinted amber – with a gutter marker, and the position is clickable, so you never count rows by hand.
  • Size, lines, depth, key count – size is the bytes of the document exactly as it sits in the editor, so it agrees with the line count beside it. Depth and total keys are read from the parsed structure.
  • Bare values and double-encoded strings accepted – "Reykjavik" validates; so does "{\"qci\":9}", and its contents are what the depth and key figures describe.
  • Format and Minify on a valid document – two-space re-indent, or everything on one line. Number literals come back exactly as typed: 8901240544102066246, 1.50 and 1e5 survive both.
  • Sort keys A to Z – rewrites a valid document with every object's keys in alphabetical order, nested objects included, and switches back to your original text if you have not typed in between. Array order is never touched.

Questions people actually ask

Why does it report one error when I can see three?

Because a JSON parser is not a linter. This page's checker and your browser's JSON.parse both stop at the first construct they cannot continue past. The worked example above is the demonstration: fix the single-quoted key and the trailing comma appears as a fresh error at Line 5, Column 22, the comma itself (Chrome's own message for it says line 6 column 1, the brace after it). If you would rather have the punctuation repaired in one pass, the JSON Fixer is the page for that.

Is a bare string really valid JSON?

Yes, since 2014. The original RFC 4627 required an object or an array at the top level; RFC 8259 replaced it and allows any value, which is why JSON.parse('"hello"') works in every current runtime. Some older server-side validators still enforce the 2006 rule, so if a document passes here and fails there, that difference is usually the reason.

It says my document is valid, but my app still rejects it.

Then the problem is shape rather than syntax: a missing required field, a string where a number was expected, an enum value nothing recognises. Syntax validation cannot see any of that. JSON Schema is the tool for the next layer, and our JSON Schema Validator will check a document against one.

How big a file can I paste?

Big enough for anything you would read on screen. The check is a single pass over the text, plus one extra JSON.parse call when it fails so the browser's message can be shown, and neither is the slow part; what does get uncomfortable is the editor rendering a multi-megabyte document while you scroll it. Past a few megabytes you are usually better off finding the one broken record and pasting that instead of the whole export.

What's the difference between validating and formatting?

Validation answers "does this parse". Formatting changes the whitespace of something that already parses. This page does both: Format and Minify appear once the document is valid, with Sort keys A to Z applied if it is on. On the Sample that moves metadata ahead of users and lists each user as active, email, id, name. The JSON Formatter is the dedicated page if reformatting is the whole job.

Does the check run on my machine?

Yes. The parse happens in your browser and neither the document nor any part of it is uploaded, cached or logged. Nothing on this page makes a network request while you type, and "Paste" reads your clipboard only at the moment you press it.

Related Tools

Useful Resources

  • RFC 8259 – The current JSON specification. Section 2 is the one that makes a bare string a valid document.
  • Stack Overflow: json – Where most parser messages have already been asked about verbatim.