JSON Validator

Validate JSON in your browser and jump straight to the error line and column. Repair trailing commas, comments and single quotes. Free, nothing is uploaded.

Runs in your browser. Your files are never uploaded. How it works

JSON Validator checks whether your JSON is valid and, if not, points to the exact line and column of the first error and moves the cursor there. It tells you what valid JSON contains, such as an object with 12 keys or an array of 50 items. If the JSON is almost right, Repair fixes common mistakes in one click. Your data stays in your browser.

How to validate JSON

  1. Paste your JSON, or click Open file to load a .json file. A file is checked as soon as it opens.
  2. Click Validate.
  3. Valid: you see what the JSON contains and a formatted copy.
  4. Invalid: the error message gives the line and column, and the cursor jumps to that spot. Fix it and validate again.
  5. Many errors at once? Click Repair to fix trailing commas, comments, single quotes and unquoted keys together.

Common JSON errors and fixes

Error Example Fix
Trailing comma {"a": 1,} Remove the last comma
Missing comma {"a": 1 "b": 2} Add a comma between items
Single quotes {'a': 'x'} Use double quotes
Unquoted key {a: 1} Put the key in double quotes
Comment {"a": 1 // note} Remove the comment
Python values {"ok": True} Use true, false, null
Special numbers {"x": NaN} Use null or a number
Unescaped quote in a string "say "hi"" Write \"hi\"

Repair handles most of these. An unescaped quote inside a string usually needs fixing by hand, since only you know where the string should end.

Where invalid JSON comes from

  • Hand-edited config files, where a trailing comma or a comment slips in.
  • JavaScript objects copied from code, with single quotes and bare keys.
  • Python output pasted from print(), with True, False and None.
  • Truncated responses from a log or a terminal, cut off mid-object.
  • Template output where a variable was empty and left "a": , behind.

Validate before you send

APIs, deployment pipelines and app configs refuse invalid JSON, often with an unclear message far from the cause. Validating first saves a round trip: you see the exact position, fix it here and send JSON you know is well-formed. To compare a working and a broken version line by line, paste both into the Diff Checker.

Also in this tool

The same page formats JSON with 2 or 4 spaces or tabs, minifies it, sorts keys and shows a collapsible tree. See JSON Formatter for all features, or JSON Minifier to make it as small as possible.

Frequently asked questions

How do I check if my JSON is valid?

Paste the JSON, or open a .json file, and click Validate. Valid JSON shows a confirmation with what it contains, for example an object with 12 keys. Invalid JSON shows the line and column of the first error, and the cursor jumps there.

What does "Unexpected token" mean?

The parser found a character it did not expect at that position. Usually it is a missing comma before it, a trailing comma after the last item, a single quote, or a stray character after the end of the JSON.

Does the validator check against a JSON Schema?

No. It checks that the text is well-formed JSON as defined by the standard, which is what APIs and config loaders need first. It does not check field names or types against a schema.

Why does the validator only show one error?

A JSON parser stops at the first problem, because everything after it may be read wrongly. Fix that error and click Validate again to find the next one, or try Repair to fix the common ones at once.

More ways to use JSON Formatter

Related tools