Free Online Tool · No Signup

JSON Validator

Paste your JSON to check it instantly. Every error is pinpointed by line and column and explained in plain English, and most can be fixed with one click.

Plain-English errorsOne-click fixJSON Schema checkFormat & minify100% private
Ln 1, Col 1

JSON Schema validation Optional

Check that your data has the right shape: required fields, types, allowed values, number ranges and formats such as email and date. Supports the common keywords from Draft 4 to 2020-12.

Runs entirely in your browser. Your JSON and schema are never uploaded or saved, not even in your browser’s storage. Files you open are read on your device.

Free Online JSON Validator

This free JSON validator checks your JSON the moment you paste it. If something’s wrong, it marks the exact spot in the editor, gives the line and column, and explains the problem in plain English with a clear way to fix it. Most mistakes, such as trailing commas, single quotes, missing commas and comments, can be repaired with a single click. You can also format or minify valid JSON and check it against a JSON Schema. Everything runs in your browser, so your data is never uploaded.

How to validate JSON

  1. Add your JSON. Paste it into the editor, click Paste, click Upload file or drag a .json file onto the editor. Click Broken sample to see how errors are explained.
  2. Read the result. It updates as you type. A green Valid JSON banner means any JSON parser will read your data, and it shows the size, the number of values and how deeply the data is nested. A red Invalid JSON banner shows how many errors were found.
  3. Go through the errors. Each error is marked in the editor and listed below it with its line and column, the problem line, why it isn’t allowed and how to fix it. Click Show to jump to it.
  4. Fix them in one click. Click the green Fix button to repair every error marked Auto-fixable. Your formatting is kept, and Undo brings back the original if you change your mind. Errors marked Fix by hand need a decision from you, such as a missing value.
  5. Format, minify or save. Once the JSON is valid, click Format to indent it with 2 spaces, 4 spaces or tabs, or Minify to remove all whitespace. Then Copy it or Download it as a .json file.

Below the editor, the status line shows the cursor’s line and column and, for valid JSON, the path of the value you’re on, such as $.items[0].price.

Common JSON errors and how to fix them

These are the mistakes the validator finds most often. Every one is explained in the tool, and most can be fixed automatically.

  • Trailing comma: a comma after the last item, as in [1, 2, 3,]. JavaScript and Python allow it, JSON doesn’t. Delete the comma.
  • Single quotes: {'name': 'Emma'} must be {"name": "Emma"}. JSON strings and keys always use double quotes.
  • Unquoted keys: {name: "Emma"} is a JavaScript object, not JSON. Put the key in double quotes: "name".
  • Comments: // and /* */ comments aren’t part of standard JSON. Remove them, or move the note into a field such as "_comment".
  • Missing comma: two items in a row with no comma between them, often after a closing } when objects are listed in an array.
  • Missing or mismatched brackets: every { needs a } and every [ needs a ], closed in reverse order. The validator tells you which bracket is open and where it started.
  • Python and JavaScript values: True, False, None, undefined, NaN and Infinity aren’t JSON. Use true, false or null.
  • Invalid escapes: a backslash starts an escape sequence, so a Windows path like C:\Users must be written C:\\Users.
  • Line breaks and tabs inside strings: a string must stay on one line. Write \n for a line break and \t for a tab.
  • Number formats: leading zeros (007), a leading plus sign, .5, 5. and hex numbers like 0xFF aren’t valid JSON numbers.
  • Invisible characters: a byte order mark or a no-break space copied from a web page, Word or Slack looks like a normal space but breaks JSON.
  • More than one value: a JSON document holds one value. JSON Lines files and pasted-together documents can be wrapped in an array.
  • A missing value: {"name": } needs a value after the colon. Only you know what it should be, so this one is fixed by hand.
  • HTML instead of JSON: text starting with < is usually an error page returned by a server instead of the JSON you expected.

Why “Unexpected token” errors are hard to read

When JSON.parse fails in JavaScript, you get messages like “Unexpected token } in JSON at position 214” or “Expected double-quoted property name”. They point at the first character the parser couldn’t handle, which is often not where the real mistake is. A trailing comma, for example, is reported at the closing bracket after it. This validator reads past the first problem, so it lists every error at once and names the actual cause, such as “Trailing comma” or “Key uses single quotes”, with the exact line and column.

JSON syntax rules

  • A JSON document is a single value: an object, an array, a string, a number, true, false or null.
  • Objects use curly braces and hold "key": value pairs separated by commas. Keys must be strings in double quotes.
  • Arrays use square brackets and hold values separated by commas.
  • Strings use double quotes. Inside them, escape " and \ with a backslash, and write control characters as \n, \t or \uXXXX.
  • Numbers are decimal, with an optional minus sign, fraction and exponent, such as -12.5e3. No leading zeros, NaN or Infinity.
  • Spaces, tabs and line breaks are allowed between values. Comments and trailing commas are not.

Check your JSON against a JSON Schema

Valid JSON can still have the wrong shape: a missing field, a number sent as a string or an invalid email address. Open JSON Schema validation, paste your schema or click Sample schema, and the validator checks your data against it as you type. Each problem is listed with its JSON path and a plain-English message, such as “$.items[0].qty must be at least 1 (found 0)”. Click Show to find the value in the editor.

It supports the keywords most schemas use, from Draft 4 to Draft 2020-12: type, enum, const, required, properties, additionalProperties, patternProperties, items, prefixItems, minItems, maxItems, uniqueItems, contains, minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, minLength, maxLength, pattern, format (email, date, time, date-time, uri, uuid, ipv4, ipv6 and hostname), allOf, anyOf, oneOf, not, if/then/else, dependentRequired and local $ref references. References to other files and the unevaluated keywords are skipped, and the tool tells you when that happens.

Valid JSON that can still cause problems

Some JSON follows the standard but behaves badly in real programs. The validator marks these as warnings:

  • Duplicate keys: when the same key appears twice in one object, most parsers keep only the last value, so data is silently lost.
  • Very large numbers: JavaScript and many other languages store numbers as 64-bit floats, which are exact only up to 9,007,199,254,740,991. Bigger IDs get rounded, so store them as strings.
  • Broken Unicode escapes: half of an emoji’s surrogate pair, such as \uD83D on its own, turns into an invalid character.

Format and Minify keep your numbers and escape sequences exactly as written, so a long ID or 1.0 is never rewritten.

JSON in tokens and encoded data

JSON often travels inside other formats. The payload of a JSON Web Token is Base64URL-encoded JSON, which you can read with our JWT Decoder & Encoder. If you have JSON encoded as Base64, decode it first with the Base64 Encoder & Decoder, then paste the result here to validate it.

Is my JSON private?

Yes. The validator runs entirely in your browser. Your JSON, your schema and any file you open are never sent to our server or saved in your browser’s storage. Only interface choices, such as your indentation setting, are remembered. That makes it safe for API responses, config files and other data you’d rather not upload.

Frequently asked questions

Is this JSON validator free?

Yes. It’s completely free, with no sign-up and no limit on how often you use it.

What does “Unexpected token in JSON at position” mean?

It’s JavaScript’s message for a syntax error. The position counts characters from the start of the text, and it usually points at the character just after the real mistake. Paste your JSON here to see the error’s line and column and what caused it.

Why is my JSON invalid when it works in JavaScript?

JavaScript object syntax is looser than JSON. It allows unquoted keys, single quotes, comments, trailing commas and values like undefined. JSON allows none of these. Click Fix to convert most JavaScript-style objects into valid JSON.

Does JSON allow comments?

No. Standard JSON has no comments. Formats like JSONC (used by VS Code settings) and JSON5 allow them, but JSON.parse and most APIs reject them. The validator flags each comment and can remove them for you.

Does JSON allow trailing commas?

No. A comma after the last item in an object or array makes the JSON invalid. It’s one of the most common JSON errors, and the Fix button removes it.

Can JSON use single quotes?

No. Strings and keys must use double quotes. Single quotes, backticks and curly “smart” quotes are all invalid, and the validator converts them to straight double quotes.

What’s the difference between JSON validation and JSON Schema validation?

JSON validation checks the syntax: whether the text is correctly formed JSON. JSON Schema validation checks the content against rules you define, such as which fields are required, what type each value has and which values are allowed.

How large a file can I check?

Files up to 60 MB can be opened. JSON up to 2 MB is checked automatically as you type. Larger files are checked when you click Validate JSON, which usually takes well under a second.

Can it validate JSON5, JSONC or JSON Lines?

It checks against standard JSON (RFC 8259). JSON5 and JSONC features such as comments, single quotes and trailing commas are reported as errors and can be fixed automatically, which turns the file into standard JSON. For JSON Lines, the validator detects multiple values and can wrap them in an array.