What parsing (deserializing) JSON does
Parsing turns a string of characters into a structured value: objects, arrays, numbers, strings, booleans and null. In most languages this step is called deserializing — JSON.parse in JavaScript, json.loads in Python, ObjectMapper.readValue in Java, JsonSerializer.Deserialize in C#. This tool runs your text through a strict parser that follows the JSON standard (RFC 8259). If the string is well-formed you get the value back, re-serialized with your chosen indentation, which confirms every bracket, quote and comma is in the right place. If it is not, you get the parser’s message plus the line and column where it gave up, with a caret under the character.
What a strict parser accepts and rejects
| Accepted | Rejected |
|---|---|
"double quoted" strings and keys | 'single quoted', unquoted keys |
true, false, null | NaN, Infinity, undefined |
-1.5, 2e10 | .5, 01, +1, 0x1F |
{"a":1}, [1,2] | trailing comma [1,2,] |
| nested objects and arrays | // comments and /* */ |
a lone "string", number, boolean or null | several values in a row (JSON Lines) |
Need to fix comments, single quotes or trailing commas automatically? The JSON formatter can repair them; this parser deliberately reports them, because that is what your production parser will do.
Deserialize stringified JSON
APIs and logs often carry JSON inside a JSON string: "{\"id\":7,\"tags\":[\"a\"]}". A strict parse of that text gives you a single string. With Deserialize stringified JSON on, the parser keeps going while the result is a string that itself holds an object or array, and tells you how many layers it removed. Turn it off to see exactly what one JSON.parse call returns. For escaping and unescaping strings by hand, use JSON escape / unescape.
Worked example
Input:
{"qty": 3, "price": 9.99, "tags": ["new", "sale"], "inStock": true}
Parsed and formatted:
{
"qty": 3,
"price": 9.99,
"tags": [
"new",
"sale"
],
"inStock": true
}
The summary line reads object · 4 keys · depth 2: qty is a number, price a number, tags an array of two strings, inStock a boolean.
Reading parser errors
| Message (varies by browser) | Usual cause |
|---|---|
Unexpected token ' | Single-quoted strings or keys. |
| Expected double-quoted property name | An unquoted key, or a trailing comma before }. |
Unexpected token ] / } | Trailing comma, or a missing value. |
| Unexpected end of JSON input | A missing closing bracket or quote, or truncated text. |
| Bad control character in string literal | A raw tab or line break inside a string; escape it as \t or \n. |
| Unexpected non-whitespace character after JSON | Two values in a row, e.g. JSON Lines, or a stray character after the closing bracket. |
When to use it
Confirm a payload will parse in production before you ship it. Check what your language’s deserializer will and will not accept. Turn a compact one-liner into something you can read. Unpack a stringified JSON value copied from a log. Teach or learn the JSON grammar by trying inputs and seeing which ones fail.
Common questions
What is the difference between parsing and validating JSON?
Parsing proves a string is well-formed JSON by turning it into a value; if it parses, it is valid JSON. Schema validation is a separate step that checks the parsed value against rules about which keys and types are allowed, which the JSON Schema Validator does.
What does it mean to deserialize JSON?
Deserializing is turning JSON text back into a data structure: objects, arrays, strings, numbers, booleans and null. JSON.parse in JavaScript, json.loads in Python and ObjectMapper.readValue in Java all deserialize. This page deserializes the text, then re-serializes it indented so you can inspect the structure.
Does the parser keep full number precision?
Numbers are parsed as IEEE 754 doubles, so integers larger than 253 and very long decimals lose precision. The tool warns when it sees such an integer. If you need exact large integers, keep them as strings in the JSON.
What does it do with duplicate keys?
The last value for a repeated key wins, matching the behavior of nearly every JSON parser. The formatted output will show only one copy of the key.
Can it parse JSON Lines (one object per line)?
No. JSONL is many JSON values, not one, so the parser stops at the start of the second line. Parse a single value here, or wrap the lines in an array first.
Is my input uploaded?
No. Parsing uses the browser’s built-in JSON.parse. Nothing is sent anywhere.