JSON Validator – Find and Fix JSON Errors

Check JSON as you type. This JSON validator highlights the exact line and column of the first error, explains the likely cause and can repair trailing commas, single quotes and comments for you.

Press Ctrl+Enter (⌘+Enter on Mac) to run now.

Result

Changes made by the fix
    Objects–
    Arrays–
    Keys–
    Max depth–
    Strings–
    Numbers–
    Booleans–
    Nulls–
    Warnings

      Valid JSONInvalid JSONLinecolumnKeyValue

      Validate JSON and Find the Error Fast

      A single misplaced comma is enough for an API to reject a request, and the parser message rarely says more than “Unexpected token”. This JSON validator checks the text while you type, marks the exact character where parsing stops in a numbered view of your input and tells you what usually causes that kind of error.

      It also catches problems that a plain syntax check misses: duplicate keys that silently overwrite each other, integers too large for JavaScript and a byte order mark at the start of a file. A one-click repair handles the mistakes people make most often when copying JSON from JavaScript code or config files. Validation runs entirely in your browser.

      Invalid JSON with a trailing comma repaired[1, 2,][1, 2] ✓JSONValidator

      How to validate JSON

      1. Paste the JSON into the left box or open a file. The result updates a moment after you stop typing.
      2. Read the result. Valid JSON shows a green badge and statistics. Invalid JSON shows the line, column and a hint, with the failing character highlighted.
      3. Click “Go to error” to place the cursor at that position in the input.
      4. Click “Fix common issues” to repair comments, single quotes, unquoted keys and trailing commas. Every change is listed with its line number, and “Undo fix” restores your original text.
      5. Check the warnings for duplicate keys and numbers that lose precision, even when the syntax is valid.

      Common JSON errors and how to fix them

      MistakeInvalidValid
      Trailing comma[1, 2,][1, 2]
      Single quotes{'a': 'b'}{"a": "b"}
      Unquoted key{a: 1}{"a": 1}
      Comment// note or /* … */Remove it, or store it in a "_comment" key
      NaN or Infinity{"x": NaN}{"x": null}
      Python literalsTrue, Nonetrue, null
      Missing comma{"a": 1 "b": 2}{"a": 1, "b": 2}
      Leading zero{"zip": 02134}{"zip": "02134"}
      Raw line break in a stringA string split over two lines"line 1\nline 2"
      Invalid escape"C:\Users""C:\\Users"

      What “Fix common issues” repairs

      The repair reads the text token by token, so nothing inside a valid double-quoted string is ever touched. It makes four kinds of change:

      • Comments (//, /* */ and #) are removed. A comment on its own line is removed together with that line.
      • Single-quoted strings become double-quoted. Escaped single quotes are unescaped, and double quotes inside are escaped.
      • Unquoted keys made of letters, digits, _ and $ get double quotes.
      • Trailing commas before } or ] are removed.

      It does not guess at anything that could change your data: NaN, undefined, missing commas and unclosed brackets are left to you. The repaired text is validated again straight away.

      JSON syntax rules in short

      JSON is defined by RFC 8259 and ECMA-404. A document is one value: an object, an array, a string, a number, true, false or null. Objects hold "key": value pairs separated by commas; keys are always double-quoted strings. Strings may contain any Unicode character except unescaped control characters, and the only escapes are \", \\, \/, \b, \f, \n, \r, \t and \uXXXX. Numbers are decimal, with an optional minus sign, fraction and exponent, but no leading zeros, plus sign, hexadecimal or NaN. Whitespace between tokens is free, which a JSON formatter uses to make data readable.

      Statistics and warnings

      For valid JSON the validator counts objects, arrays, keys and values and reports the maximum nesting depth. Warnings point to things that are legal but risky:

      • Duplicate keys: RFC 8259 says keys “SHOULD be unique”. JavaScript, Python and most other parsers keep the last value without telling you.
      • Large integers: values beyond 9,007,199,254,740,991 are rounded by JavaScript, so 9007199254740993 becomes 9007199254740992. Send long IDs as strings.
      • Deep nesting: more than 64 levels can hit the depth limits of some parsers.

      Need to check structure, not just syntax? Describe the expected shape with the JSON Schema Builder. Validating one JSON object per line? Use the JSONL validator.

      Frequently Asked Questions

      Common questions about validating JSON.

      Paste it into the validator. A green “Valid JSON” badge means it parses; otherwise you see the line, column and a hint, and the error position is highlighted in a numbered view of your input.

      The parser reports where it stopped, which is often just after the real mistake. Check the end of the previous line for a missing comma or quote.

      No. JavaScript, JSON5 and many config formats accept them, but strict JSON does not. “Fix common issues” removes them automatically.

      No. The JSON specification has no comment syntax. Formats such as JSONC (used by VS Code settings) and JSON5 allow them, but a standard parser rejects them.

      Yes. It only removes comments and trailing commas and adds or changes quotes outside existing strings. Every change is listed by line, and “Undo fix” brings back your original text.

      A validator tells you whether the text is valid and where it breaks. A formatter changes the layout of valid JSON to make it readable.

      No. It checks syntax and common data issues such as duplicate keys. To define the structure your data should have, build a schema with the JSON Schema Builder.

      No. All checks run in JavaScript in your browser, so your data stays on your device.