What a JSON parser online checks for you
A JSON parser online reads your text against the strict JSON grammar and, if every character fits, turns it into values: objects, arrays, strings, numbers, booleans and null. This page performs both steps while you type. It stops at the first character that breaks the grammar and says what it expected there, or, when the text is valid, it lays out the parsed values so you can check their types before your own code relies on them.
The parser shares its interface with the JSON Viewer. Use this page when the question is "will this parse, and what comes out?"; use the JSON Viewer when you mainly want to browse a large document, and the JSON Formatter when you need indented text with a choice of indent to paste somewhere else.
Reading parse errors and their positions
Parsers read from left to right, so an error is reported at the first point where the text can no longer be valid, which is not always where the mistake was made. These are the messages this page gives for common problems:
| Input | Message | Reported at |
|---|---|---|
{"a":1,} | Trailing comma before '}' is not allowed | Line 1, column 8 |
{'a':1} | Property names must be wrapped in double quotes, not single quotes | Line 1, column 2 |
{"a":1 then "b":2} on the next line | Expected ',' or '}' but found '"' | Line 2, column 1 |
{"x":NaN} | NaN and Infinity are not valid JSON numbers | Line 1, column 6 |
The missing-comma case is the one that misleads people: the comma belongs at the end of line 1, but the parser notices only when it reaches the next key on line 2. Look just before the reported position as well as at it. Columns here count from 1. Language parsers phrase the same problem differently and some add a zero-based character offset; Python, for instance, reports the trailing comma above as Expecting property name enclosed in double quotes: line 1 column 8 (char 7). When an error appears, Go to error moves the cursor to the spot and Try Repair attempts an automatic fix.
What types come out of the parser
After a successful parse, the Tree tab lists every key with its value, and the header shows the size, the maximum depth, the number of keys and the total number of nodes. Click a key and the path bar shows its JSONPath together with the parsed type, for example $.founded with number · 2014 in the sample. That is the quickest way to catch a value that arrived as the string "2014" when your code expects a number, or an empty string where you expected null. The Table tab shows arrays of objects as rows and columns, and Graph draws the nesting as connected boxes.
Parse pitfalls: big integers, duplicate keys and trailing commas
Valid JSON can still parse into something other than what was written. Paste {"id":9007199254740993,"dup":1,"dup":2,"f":1.50} and press Format; the parsed values come back as:
{
"id": 9007199254740992,
"dup": 2,
"f": 1.5
}
- Integers above 9,007,199,254,740,991. JavaScript stores every number as a 64-bit float, so the ID was rounded to the nearest value it can represent. Python's
jsonmodule keeps it exact, and PHP'sjson_decodeturns it into a float unless you passJSON_BIGINT_AS_STRING. The dependable fix is to send such IDs as strings. - Duplicate keys. RFC 8259 says names within an object should be unique but does not forbid repeats, so behavior is up to the parser. JavaScript and Python keep the last value without warning. To detect duplicates in Python, pass an
object_pairs_hooktojson.loads. - Trailing commas and comments. Both are rejected by every strict parser, including
JSON.parse, even though JavaScript object literals allow them. The JSON fixer removes them in bulk. - Number spelling.
1.50becomes1.5and1e2becomes100, because a parser keeps values, not their original text.
Parsing escaped JSON strings
Sometimes the text is valid JSON, just not the JSON you meant. A value copied from a log, such as "{\"a\":1}", parses successfully, but the result is one string rather than an object. The tree shows a single string at $ and the status reads Valid JSON · 0 objects, 0 arrays, depth 0. In code, the equivalent is that JSON.parse hands back a string and a second JSON.parse is needed on it. To unwrap such values here, use String to JSON, which removes one or more layers of encoding and formats the document inside.
A successful parse is not a valid shape
Parsing proves only the syntax. It does not prove that price is present, that items is an array or that status holds a value your code handles. Describe those rules once and check documents against them with the JSON Schema validator. The grammar this parser enforces is defined in RFC 8259.