How to Validate JSON: Find Errors Fast

Last updated: · 3 min read

JSON is the most common format for API responses, configuration files and data exchanged between applications. A single stray comma or quote can stop a whole document from being read, and the error message is not always clear about where the problem is. The JSON Validator checks the text against the standard parsing rules. If the JSON is valid, it reports the root type, the number of keys or items and the size; if not, it reports the line and column of the error and shows the offending line. The check runs in your browser.

Formula

1. Read the text from left to right according to the RFC 8259 syntax; recognise objects, arrays, strings, numbers and the literals true, false and null.
2. Pass each character through a stack-based parser and stop at the first unexpected character.
3. Convert the position of the error into a line and column by counting characters.
4. If the text ends without error, calculate the root type, the number of keys or items and the size in bytes.
5. Write the validity status and the details together.

This is not a mathematical formula but a parsing algorithm. The rules come from IETF RFC 8259 and ECMA-404, and every step checks the structure of the document one token at a time. The line and column numbers pinpoint the exact position of the error.

What the inputs mean

JSON
The JSON text to check. It can be an API response, a configuration file or a copied object. It does not matter whether it is indented or on a single line.

Worked example: Checking JSON with a trailing comma

  1. Input: {"name": "Ali", "age": 30,} (there is an extra comma at the end of the object)
  2. After the value 30 the parser expects a comma or a next key, but it finds the closing brace } instead.
  3. The error is reported as 'Unexpected character' at the } on line 1, column 27.
  4. The tool prints the offending line and marks the position with a caret (^) underneath.

Result: The document is invalid: the extra comma on line 1 must be removed before the JSON is accepted.

✅ JSON Validator

Free, no sign-up; your data stays in your browser.

Open the calculator →

How to read the result

The validator checks syntax only. It does not confirm what the fields mean, whether values fall within expected ranges, or whether the data matches a JSON Schema. Valid JSON can still lack the fields your program expects, so run schema validation separately for production data. This is general information.

Common mistakes

  • Using single quotes; JSON keys and string values must use double quotes.
  • Leaving a comma after the last item; JavaScript accepts it, JSON does not.
  • Adding comments with // or /* */; standard JSON does not support comments.
  • Writing leading zeros in numbers such as 007; JSON numbers cannot start with unnecessary zeros.
  • Forgetting to escape a double quote inside a string; it must be written with a backslash before it.

Frequently asked questions

Does the JSON validator store my data?

No. The check runs in your browser and the text is not sent to a server, so you can paste API keys safely.

Why are the line and column numbers important?

The parser reports the error where it notices it. The column number points to the exact character, which makes the fix quicker.

Does valid JSON always mean the data is correct?

No. Only the syntax is checked. Field names, types and value limits must be verified separately.

What does the root type tell me?

It shows whether the outermost layer of the document is an object ({...}), an array ([...]) or a single value.

The result is not exact or binding and is for information only; it is not an official document and cannot be used in official procedures. Confirm it with the competent authority or a professional before acting; no liability is accepted for losses arising from its use.

Sources

Choose your cookie preference to continue

Records the site needs to work (theme, language, favourites) stay in your browser.

This site is free and funded by ads.

With your consent, Google Analytics cookies measure visits and Google AdSense cookies are used to show ads; the data is processed on Google servers abroad.

If you reject, the site works just the same.

Cookie Policy · KVKK notice