JSON Parser Online
A JSON parser reads text, checks it against the JSON grammar in RFC 8259, and turns it into values: objects, arrays, strings, numbers, true, false and null. If the text breaks the grammar, for example with a trailing comma, single quotes or a comment, parsing fails. Paste JSON below to see its structure or the exact error.
Paste JSON and parse it
The page parses as you type, with the browser's own JSON.parse. Valid input shows a summary (the top-level type and how many objects, keys, arrays, array items, strings, numbers, booleans and nulls it holds, and the nesting depth) and a tree with each value's type. Switch to Text for the indented JSON. Invalid input shows the first error with its line and column and the line itself with a caret under the spot. Repair and view runs the same engine as the JSON repair tool and parses the result. Empty input shows nothing.
What a JSON parser does
Parsing turns text into values. The parser reads one character at a time and either builds the objects, arrays and scalars the text describes or stops at the first character the grammar does not allow. That is a syntax check only. Whether the data has the fields and types your program expects is a separate question, answered by a JSON Schema; the schema generator writes one from a sample.
The value types a parser returns
RFC 8259 defines four primitive types and two structured types:
- object —
{"name": value, …}, names are strings - array —
[value, …], ordered - string —
"text"in double quotes - number —
-12.5e3; no leading zeros, no NaN or Infinity - boolean —
trueorfalse - null
A JSON text can be any one of these at the top level, so "hello" and 42 are valid JSON documents. Try them in the box: the summary shows the top-level type.
Why parsing fails
These are the messages this page reports for the usual faults, and what the repair step returns:
| Problem | Invalid JSON | Reported error | Repair result |
|---|---|---|---|
| Trailing comma | {
"a": 1,
"b": 2,
} | Line 4, column 1: Trailing comma — remove the comma before the closing }. | {"a":1,"b":2} |
| Single quotes | {
'a': 1
} | Line 2, column 3: Property names must use double quotes ("), not single quotes. | {"a":1} |
| Unquoted key | {
a: 1
} | Line 2, column 3: Property names must be wrapped in double quotes. | {"a":1} |
| Comment | {
// note
"a": 1
} | Line 2, column 3: Comments are not allowed in JSON — remove them. | {"a":1} |
| Wrong closing bracket | {
"a": [1, 2
} | Line 3, column 1: Mismatched bracket: found } but the array opened at line 2, column 8 needs ]. | {"a":[1,2]} |
| Leading zero | {"a": 012} | Line 1, column 7: Numbers cannot have leading zeros (write 7, not 07; quote it if it is an ID). | {"a":"012"} |
The leading-zero row shows that repair can guess: 012 becomes the string "012". Check repaired output before you rely on it. The validator gives the same yes/no answer without the tree.
Parse JSON in code
JavaScript has JSON.parse; Python has json.loads. Both throw on invalid input:
// Node.js 24
JSON.parse('{"a": 1,}')
// SyntaxError: Expected double-quoted property name in JSON at position 8 (line 1 column 9)
# Python 3.12
import json
json.loads('{"a": 1,}')
# json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 9 (char 8)Two behaviours differ from what you might expect. With a repeated key, both keep the last value: {"a":1,"a":2} parses to {"a": 2}; RFC 8259 says names should be unique and leaves duplicates to the implementation. Large integers differ: JavaScript reads 12345678901234567890 as 12345678901234567000 (64-bit floating point), while Python keeps the exact integer. RFC 8259 notes that integers beyond 253−1 are not reliably exchanged. This page uses the browser's parser, so it shows the JavaScript result.
After parsing: format, query, compare, convert
- Format or minify the text.
- Query it with JSONPath.
- Compare two documents.
- Generate TypeScript types or a JSON Schema.
- Do all of it in JSON Studio. Unknown terms are in the glossary; the repair engine has an HTTP API.
Privacy and limits
The parser runs in your browser and does not send your JSON anywhere. Files up to 50 MB open; larger ones are refused with a message. In desktop Chrome a 1.7 MB file showed as a tree in about half a second, a 17 MB file in about 1.2 seconds and a 42 MB file in about 2 seconds. Text over 1 MB is kept out of the input box, and the Text view draws the first 1 MB of indented text (Copy still copies all of it). Phones and older computers are slower.
Frequently asked questions
A JSON parser reads JSON text, checks it against the grammar in RFC 8259, and produces the values it describes. If the text is not valid JSON, it reports a syntax error instead.
Parsing checks that the text follows JSON syntax and builds the values. Validating often means the same syntax check, but it can also mean checking the values against a JSON Schema, which is a separate step.
Common causes are trailing commas, single-quoted strings, unquoted keys, comments and missing brackets. RFC 8259 allows none of these. The error position points at or just after the problem.
Yes. RFC 8259 allows any JSON value at the top level, including a string, number, true, false or null. The older RFC 4627 required an object or array.
Yes. Click Repair and view on this page, or use the JSON repair tool, which also lists every change. Both run in your browser, are free and need no signup.
The JSON Medic newsletter
One JSON error and its fix, weekly, plus new guides and tools. Free.
We send a confirmation link first. Unsubscribe with one click in any mail. See the privacy policy.
Related JSON tools