Developer tools
JSON validator and JSON syntax checker
This JSON validator checks whether text is valid JSON. Paste JSON or open a .json file, and it runs the check in your browser with the browser's own strict JSON parser. Valid input shows its top-level type. Invalid input shows the parser's error message, with a line and column when the browser's message gives a position.
Paste JSON, or open a UTF-8 file to validate it.
Text input uses browser line endings.
Validation result
Enable JavaScript to validate JSON.
Download original .jsonSyntax validation only. No formatting or automatic fixes.
How to check JSON syntax
To check JSON syntax, paste the text or open a file, then select Validate JSON. The answer appears under Validation result.
- Paste JSON into the JSON input box. To validate a JSON object, paste it with both braces, because a fragment such as "a": 1 fails. To validate a JSON file, select Open file and choose a .json or .txt file. Opening a file starts the check at once and puts the file's text in the box.
- Select Validate JSON. The check runs in a background worker, and Cancel stops it.
- Read the Validation result. Valid JSON reports its top-level type, such as object or array. Invalid JSON reports the parser's message and, when the browser gives a position, a line and column. Focus then moves to the text box.
- Fix the text and select Validate JSON again. Any edit clears the old result.
- When the JSON is valid, select Download original .json to save it as validated-original.json. Reset clears the text, the file and the result.
What the JSON syntax check finds
The check applies the strict JSON grammar through JSON.parse, the parser built into your browser. Valid JSON is exactly one value. That value can be an object, array, string, number, true, false or null, so "hello" and null are valid on their own. Strings and property names need double quotes.
The parser rejects empty input, comments, single quotes, trailing commas, leading zeros such as 01, NaN, undefined and a byte order mark. It also rejects two values in a row, which is why a JSON Lines file with two records fails. The parser stops at the first error, so fix that one and validate again to find the next.
The text below has a trailing comma after "n": 1. A strict parser expects another property name there.
{
"n": 1,
}Chromium reports "Expected double-quoted property name in JSON at position 12 (line 3 column 1)". Two line breaks come before offset 12, so the tool reports line 3, column 1, which is the closing brace.
Why the download keeps your original JSON
When the JSON is valid, Download original .json saves the text you pasted or the exact bytes of the file you opened. The tool never rebuilds JSON from the parsed value, because a parse and print round trip can change the data.
Large integers lose number precision in a parse. JSON.parse turns every JSON number into a 64-bit float, so it reads 9007199254740993 as 9007199254740992. The downloaded file still holds 9007199254740993.
Duplicate keys are another case. JSON.parse keeps only the last "a" in {"a":1,"a":2}, and the download keeps both. Key order, spacing and number text such as 1e999 or -0 stay as written too.
An opened file keeps its own line endings until you edit the text. Pasted text takes the LF line endings of the text box and saves as UTF-8. One pasted case cannot save unchanged. A lone UTF-16 surrogate character has no UTF-8 form, so the tool offers no download and says why.
Limits
This JSON checker tests syntax only. It does not validate against a JSON Schema, check required fields or warn about duplicate keys. It does not format, minify or repair JSON.
Only strict JSON passes. Comments, single quotes and other JSON5 or JSONC extras fail. An opened file must be valid UTF-8, or the check stops with "This file is not valid UTF-8". A UTF-8 byte order mark fails the syntax check.
The tool checks one input at a time and sets no size cap of its own. The browser sets two limits: available memory and the longest string it can hold. In Chromium 153, that string limit is 536,870,888 characters, about 537 MB of plain ASCII text. Cancel stops a long check.
When the browser cannot decode the file within its text-size or memory limit, the check stops with "The browser could not decode this file within its text-size or memory limit." This includes Chromium returning empty text for a file past its string limit.
When the result shows no line and column
A line and column appear only when the browser's error message includes a position. The tool reads that position from the message and turns it into a line and column. When the message has no position, the result says the browser did not provide an exact error location. The parser's message below it still names the problem.
Safari 26 puts no position in its JSON error messages, so in Safari the result never shows a line and column. For [1,], Safari reports "Unexpected comma at the end of array expression".
In Chromium 153, these inputs give a message with no position: empty input, a leading comment, NaN, a byte order mark and the trailing comma in [1,]. Except for empty input, each of those messages quotes the text near the error instead.
Where a line and column do appear, columns count UTF-16 code units. An emoji such as 😀 therefore counts as two columns.
Questions
How do I validate JSON?
Paste the JSON into the JSON input box, or open the file, and select Validate JSON. A valid result names the top-level type, such as object. An invalid result shows the parser's message and, where the browser gives a position, a line and column. Fix the error and validate again until the result is valid.
What counts as valid JSON?
Valid JSON is one value: an object, array, string, number, true, false or null. Strings and property names use double quotes. A number cannot have a leading zero such as 01, and NaN and undefined are not JSON values. Comments and trailing commas are not part of JSON, so this validator rejects them.
Is null valid JSON?
Yes. A JSON text can be any single value, so null on its own is valid JSON, and so is a lone string, number, true or false. Paste null and select Validate JSON, and the result reports valid JSON with the top-level type null. Inside an object or array, null is a valid value too.
How to make a valid JSON?
Start from the error this validator reports and fix it. Common fixes are double quotes in place of single quotes, no trailing comma after the last item, no comments and a closing bracket or brace for every opening one. Validate after each fix, because the parser stops at the first error. The tool does not repair JSON.
Is there an online validator for JSON format?
Yes, this page is an online JSON format checker, and you install nothing. Paste JSON or open a .json or .txt file, then select Validate JSON. The result shows either valid JSON with its top-level type, such as object, or the parser's error message. It checks syntax only and leaves your text as written.
Are my files uploaded?
No, the check runs in your browser tab, in a background worker. The tool's code, including that worker, makes no network call, so it does not send your text or file anywhere. The page's security policy also allows network connections only to the site's own address. The tool writes nothing to browser storage.
How to test a JSON file?
Select Open file and choose a .json or .txt file saved as UTF-8. The check starts at once and puts the file's text in the box. The result shows valid JSON with its top-level type, or the parser's message. A valid file downloads byte for byte as validated-original.json.
Is not valid JSON meaning?
It is the end of a Chromium parser message. In Chromium 153, a leading comment, NaN and the ] in [1,] each give it, because a value should start there and that character cannot start one. The quoted part is the text near the error. These messages give no position, so the result shows no line and column.
What does "Unexpected token '<'" mean in JSON?
The text starts with <, and a JSON value cannot start with <. A standard HTML page starts with <!DOCTYPE, so the message quotes <!DOCTYPE. In code, it usually means a request that expected JSON got a web page, such as an error page. This validator shows the same message for pasted HTML.
How can I validate a JSON string in JavaScript?
Pass the string to JSON.parse inside a try and catch block. If JSON.parse throws a SyntaxError, the string is not valid JSON, and the error message describes the problem. This page runs the same call in a Web Worker. When the message gives a position, the page converts it to a line and column.
Related tools
- View valid JSON as a collapsible tree: expand or collapse nested objects and arrays, and copy values and paths.
- Compare two JSON documents: see each change at its JSON Pointer path.
- Turn JSON records into a table: export the rows as CSV or HTML.