JSON Validator

Check whether your JSON is syntactically valid, with an approximate error location if it isn't.

1

How to Use the JSON Validator

  1. Paste your JSON into the box.
  2. Click "Validate".
  3. See whether it's valid, or an error message with an approximate line/column if it isn't.

What the Validator Checks

Your text is passed to JSON.parse, the same strict parser used by browsers and Node.js. The JSON grammar (defined in RFC 8259 and ECMA-404) is much narrower than JavaScript object syntax, so something that works fine inside a .js file is often rejected here. To pass, the text has to follow these rules:

  • Every key is a string wrapped in double quotes. Unquoted keys and single-quoted keys are errors.
  • String values also use double quotes only. Curly “smart” quotes copied from Word, WhatsApp or a notes app are not accepted.
  • No comma after the last item in an object or array, and no comments of any kind.
  • Only seven kinds of value exist: string, number, true, false, null, object and array. undefined, NaN, Infinity, functions and Date objects are not JSON; dates are normally written as strings such as "2026-10-02".
  • Numbers cannot have leading zeros (011), a leading plus sign, a trailing decimal point (5.) or hexadecimal form (0x1F).
  • A line break or tab inside a string must be written as an escape sequence: \n, \t. A literal backslash is written as two backslashes: \\
  • Whitespace between tokens may only be spaces, tabs and line breaks. An invisible byte-order mark (BOM) at the very start, which some Windows editors add when saving, makes JSON.parse fail.

Common Errors and Their Fixes

ProblemInvalidValid
Single quotes{'city': 'Pune'}{"city": "Pune"}
Unquoted key{city: "Pune"}{"city": "Pune"}
Trailing comma[1, 2, 3,][1, 2, 3]
Missing comma{"a": 1 "b": 2}{"a": 1, "b": 2}
Leading zero in a number{"std": 011}{"std": "011"}
Python-style values{"active": True, "note": None}{"active": true, "note": null}
Smart quotes{“name”: “Ravi”}{"name": "Ravi"}

The leading-zero row is a common trap with Indian data: STD codes like 011, phone numbers and account numbers are identifiers, not quantities. Store them as strings so the zero is kept and no system tries to do arithmetic on them.

Worked Example: Reading the Error Location

Suppose you paste these four lines:

{
  "name": "Asha",
  "age": 29,
}

In Chrome or Edge the parser stops at character position 33, and the tool reports Line 4, Column 1, which is the closing curly brace. The brace itself is fine. The real mistake is the trailing comma after 29 on line 3: having seen a comma, the parser expects another key, finds the brace instead and gives up. Deleting that comma makes the JSON valid.

This pattern is typical. The reported spot is where the parser gave up, which is usually at or just after the actual error. A missing comma is reported at the start of the next key, and an unclosed string or bracket is often reported at the very end of the input. Always check the reported line and the line above it.

The wording after "Invalid JSON:" comes from your browser, so it varies. Chromium-based browsers usually mention a character position, which the tool converts to a line and column. Firefox normally includes the line and column in its own message, and some browsers give no location at all.

What "Valid JSON" Does Not Tell You

  • Duplicate keys pass. JSON.parse keeps the last value, so an object with "id": 1 followed by "id": 2 is accepted and quietly ends up with id 2. Other parsers may keep the first value or reject the input, so remove duplicates anyway.
  • Very large integers are valid syntax but lose precision in JavaScript. Integers above 9,007,199,254,740,991 cannot be stored exactly, so a 20-digit order or transaction ID sent as a number can come back with its last digits changed. Send long IDs as strings.
  • Correct structure is not checked. Missing required fields, wrong data types or out-of-range values are only caught by validating against a JSON Schema or by your own application code.

The check itself runs in your browser with JSON.parse; the validator does not need to send your text anywhere to test it.

Frequently Asked Questions

It attempts to parse your text using the browser's built-in JSON parser. If parsing succeeds, your JSON is syntactically valid; if it fails, the parser's error message (including position) is shown.

When the browser's error message includes a character position, the tool converts that position into an approximate line and column number to help you locate the problem faster.

No, this only checks that your text is syntactically valid JSON (correct brackets, quotes, commas, etc.) — it does not validate against a JSON Schema or check specific field types/values.

JavaScript object literals allow unquoted keys, single quotes, trailing commas, comments and values such as undefined. JSON allows none of these. Quote every key with double quotes, switch to double-quoted strings, remove trailing commas and comments, or generate the text with JSON.stringify instead of copying it by hand.

Yes. Under the current standard, RFC 8259, any JSON value can stand alone, so 42, true, null or a double-quoted string by itself is valid and this tool accepts it. Some older systems expect the top level to be an object or array, so check what the receiving API requires.
5.0 out of 5 (1 rating)
Rate this calculator:

Related Calculators

Was this tool helpful?