Check whether your text is valid JSON and see where it breaks.
What it does
JSON Validator checks whether your text is valid JSON and, when it is not, shows where the first problem is. It answers with a verdict and, when the text is valid, also shows it formatted, with the same layout JSON Formatter gives with “2 spaces” selected.
Use it before you send JSON to a program, an API or a configuration file that would reject it.
What it supports
- Any JSON value can be the whole text: an object, a list, a string, a number, true, false or null.
- Strict JSON: names and strings in double quotes, no comments, no trailing commas, no single quotes, no leading zeros and no NaN.
- Only the first problem is reported, because everything after a syntax error is unreliable. Fix it and validate again to find the next one.
- A name repeated inside one object is valid JSON, so the verdict is valid, but a warning lists every repeat with its line and column, because programs disagree about which value wins.
- A string with an unpaired surrogate escape, such as \ud800, is also valid, with a warning, because programs handle it differently.
- Numbers are judged by JSON syntax, not by size: 1e400 and 9007199254740993 are valid.
Good to know
- Valid means the text follows the JSON syntax. The validator does not check that the data has the fields or values your program expects.
- If the first problem is a trailing comma, or the text starts with an invisible byte order mark (BOM), the tool offers a correction. You see the change first, and nothing changes until you press “Apply correction and run again”, which applies it and validates again. Text that starts with a BOM gets no verdict until you decide.
- The formatted text always uses 2 spaces: there is no indentation option and no tree. A text that is not valid gets only the verdict, and so does a valid text whose formatted version would be larger than 2,000,000 bytes. In those cases there is nothing to copy or download.
- JSON nested deeper than the limit is refused as beyond what the tool processes. It is not called invalid, because deep nesting is legal JSON.
- Empty input gets a note asking for content, not a verdict.
How to use it
- Paste or type your text in the input box. Nothing runs while you type.
- Press “Validate”.
- Read the verdict. “The JSON is valid.” means the text follows the JSON rules. “The JSON is not valid.” comes with the first problem found, its line and column, and the spot highlighted in your text.
- When the verdict is valid and the formatted text appears, press “Copy” to put it on your clipboard or “Download” to save it as formatted.json.
- Fix the problem in your text and press “Validate” again. Editing your text clears the old verdict, so a verdict on screen always matches what you validated.
Examples
A valid text
Paste this text and press “Validate”. It follows every JSON rule, so the verdict is “The JSON is valid.” In the tool, the result also shows the text formatted.
{"id": 12, "tags": ["a", "b"], "note": null}The JSON is valid.
A missing comma
A comma is missing between the two members. The verdict is “The JSON is not valid.”, followed by what the tool expected and the line and column where it noticed the problem, which is also highlighted in your text.
{
"name": "Ana"
"age": 31
}The JSON is not valid.
A comma (,) was expected between items.
Line 3, column 3
Valid, with a warning
The name “id” appears twice in the same object. That is valid JSON, so the verdict is valid, but the tool warns you because programs disagree about which of the two values wins.
{"id": 1, "id": 2}The JSON is valid.
A name is repeated 2 times in the same object. Programs disagree about which value wins, so results can differ.
Limits and privacy
Size limits
- Input: up to 2,000,000 bytes of UTF-8 text (about 2 MB). Accented letters and emoji take more than one byte each. Larger input is rejected.
- Nesting: up to 256 levels of objects and lists inside each other. Deeper JSON is refused because it is beyond what the tool processes.
- Time: a run that takes longer than its time limit is stopped. Try a smaller input.
Your privacy
The text you type or paste, or open from a local file, is processed locally in your browser, in a dedicated Web Worker. It is never uploaded or sent to the server (a file you open is read in your browser only), and it is not written to storage, cookies or the address bar.
“Copy” puts the result on your clipboard and “Download” saves it as a file, but only when you press the button. The file is created in your browser, so nothing is uploaded.
For the full details, see the Privacy Policy
Related tools and pages
Your text stays in the page when you switch tools in the same tab, so you can try the same text in another tool. Reloading or closing the tab ends it.