Valid objects report how many keys they have. Valid arrays report how many items. A single string, number, true, false or null is reported as that value. Invalid text stops at the first syntax error.
How to use
- Paste one JSON value. Up to 20,000 characters.
- Press Parse and read Status first.
- If the status is invalid, fix the line and column the parser names. Reset restores {"ok":true}.
Formula / how it works
Success. JSON.parse is the parser. After it returns, the page looks at the value once. Null is null. An array is an array, with its length. Anything else that is an object is an object, with the number of its own keys, not the keys of nested objects. A number, a string or a boolean is printed with JSON.stringify so a string of digits is visibly quoted and a number is not. The character count is the length of the text you pasted, including spaces. The JSON formatter is what you want when the text is valid and you need it indented. The JSON viewer lists a path for every nested value. This page stops at the root, which is the right depth when you only need to know whether the file parses and what sits at the top.
Failure. The engine’s error message is kept, and a position inside that message is turned into a line and a column. Line 1, column 1 is the first character. The column counts characters, not screen cells, so a tab is one character. A trailing comma is invalid. A bare key is invalid. A single-quoted string is invalid. Comments are invalid. The page does not remove the comma for you and parse again. A parser that repairs the file hides the bug you were trying to find. The status line says invalid, and the parser line quotes the engine.
One value. The input is one JSON value, not a stream of values and not JSON Lines. Two objects one after another fail, which is correct. An empty box fails before the parser, because there is nothing to judge. Whitespace around a value is allowed, because the parser allows it, and it counts toward the character total.
Size. Twenty thousand characters is enough for a configuration file and small enough to keep a bad paste from stalling the tab. A multi-megabyte export is a job for a streaming tool on the machine that holds the file. Nothing you paste is stored.
What you can trust. If the status is valid, JSON.parse accepted the text under the same rules a browser uses. If your server uses a stricter parser, or a parser that allows comments, this page will not match it. For ordinary JSON, the rules are the same.
Numbers and strings. A root value of 3 is a number. A root value of "3" is a string, and the result shows the quotes. That difference is why a small parser is worth having before you hand the text to code that branches on typeof. Nested structure is intentionally not expanded. If the root is valid and you then need the third item of an array inside a key, open the viewer. Staying shallow keeps the success output to four lines, which is small enough to paste into a bug report next to the error output.
Worked examples
A one-key object
Inputs: JSON: {"ok":true}
Paste {"ok":true} and press Parse. The root is an object with one key.
Result: Status: valid
Root: object
Keys: 1
Characters: 11
A trailing comma
Inputs: JSON: {"ok": true,}
Paste {"ok": true,} and press Parse. The comma after the value makes the text invalid, and the column points at the problem.
Result: Status: invalid
Line: 1
Column: 13
Parser: Expected double-quoted property name in JSON at position 12 (line 1 column 13)
Use cases
- Checking a config snippet before you save it.
- Finding the column of a trailing comma.
- Confirming that the root is an array rather than an object.
- Seeing a quoted string so a numeric string is not mistaken for a number.
Tips & limitations
- Use the viewer when you need every nested path.
- Use the formatter when you need indentation.
- Do not expect this page to remove a trailing comma.
- One value only. Two objects in a row are invalid.
FAQ
How is this different from the viewer?
The viewer lists a path for each nested value. This page reports the root, or the first syntax error.
Will it fix my comma?
No. Repairing the text would hide the error. The column tells you where to look.
Does it allow comments?
No. Comments are not JSON. The status will be invalid.
What does Keys count?
The keys of the root object only. Keys inside nested objects are not added in.
Can I paste JSON Lines?
No. The parser expects one value. A second value after the first is a syntax error.
Is the text uploaded?
No. JSON.parse runs in the browser.
Runs entirely in your browser; nothing is uploaded. Check the output before you rely on it in production code, data or security decisions.