Local JSON tool
JSON Validator
Validate parses one JSON value and stops there. It does not beautify, minify, or draw a tree. When the text is valid you get a confirmation and the character count. When it is not, you get the parser message, the line, and the column.
Runs in your browser. JSON is not uploaded. Privacy policy
How the location is chosen
The page uses JSON.parse. If that throws, the message usually contains a character position. The line is the number of line breaks before that position, counting from 1. The column is the number of characters since the previous line break, also counting from 1. If the message says the input ended unexpectedly, the position is the end of the text. The excerpt shows two lines of context on either side when they exist, and the failing line is marked.
{
"active": true,
}That object fails on the closing brace. The comma after true says another property is coming, and the brace is not a property. The column points at the brace. The comma you need to delete is the character just before it. This is the usual shape of a trailing-comma error, and the validator will not remove the comma on its own.
What valid means here
Valid means the text is one JSON value. Objects, arrays, strings, numbers, true, false, and null all qualify. Two values in a row do not, even if each half would parse alone. A comment does not. Single quotes do not. An unquoted key does not. Empty input, including spaces and line breaks only, is reported as empty rather than as invalid JSON. A leading byte-order mark is stripped first so a file that is otherwise valid still passes.
A successful check does not rewrite the input. The character count is the length of the text that was parsed, after a byte-order mark is removed if one was present. Copy still places a two-space pretty print on the clipboard, because that is the useful thing to take into another editor. The input itself stays put. If you wanted the rewrite on screen, use the JSON beautifier or the JSON formatter.
Failures that look like data bugs
A single quote is not a JSON string delimiter, so a document copied from a language that allows single quotes fails at the first quote. Smart quotes from a chat app fail the same way. A number with a leading plus, or a hexadecimal number, is not a JSON number. Undefined is not null. The word NaN is not a number. The validator reports the position; it does not coerce those tokens into JSON.
If the text is valid and you still do not trust it, open the JSON viewer and read the types as words. A string "1" and a number 1 look similar in a hurry and different in the tree. Search can jump to the key you meant to inspect. The JSON tree viewer documents how deep branches start folded.
Use the column
- Read the line and column in the status line before you read the excerpt.
- On that line, look at the character just before the column.
- Fix one error. A later error is often a consequence of the first one.
- Validate again. Repeat until the status says the JSON is valid.
- Only then beautify, minify, or open the tree.
Questions
Does validate format the JSON?
No. The result panel confirms validity or shows the error excerpt. The input is not replaced. Copy can still give you a two-space reprint after a successful parse.
Why is an empty box not invalid?
There is nothing to parse. Calling that a syntax error sends you looking for a bracket that is not there. Paste a value and validate again.
The column seems to point at the wrong character.
The column is where the parser stopped accepting input, which is often one character after the real mistake. A trailing comma is reported on the token that follows the comma. Check the previous character, then validate again.
Can I validate a file without pasting?
Use Open file or drop the file on the input. The file is read in the browser and is not uploaded. Very large files still parse locally; only the tree view asks before drawing a document over 1.5 million characters.