JSON Validator & Linter

This JSON validator checks your text against the official JSON grammar and tells you exactly where it breaks: line, column, what was found and what to change. It works as a quick JSON lint for API payloads, config files and data exports, and it runs entirely in your browser.

Invalid JSON at line 4, column 27

Trailing comma before "]"

Tip: Remove the last comma. JSON does not allow a comma after the final item.

  2 |   "name": "widget",  3 |   "version": "1.2.0",> 4 |   "tags": ["tools", "json",],                                ^  5 |   "enabled": true  6 | }

Runs entirely in your browser. Nothing you paste is uploaded or stored.

What does a JSON validator check?

A JSON validator checks that the text follows every rule of the JSON grammar in RFC 8259, from double-quoted keys to the placement of commas. This one stops at the first rule that is broken and shows its line and column, the characters around it and a likely fix. The sample above has a trailing comma so you can see how an error looks.

How to use the JSON checker

  1. Paste JSON into the box, drop a file on it, or click Open file.
  2. Read the result below the box. Valid JSON shows its type, the number of keys and values, nesting depth and size in bytes.
  3. For invalid JSON, press Go to error to put the cursor on the problem, fix it, and the check runs again immediately.
  4. Fix errors one at a time. A single missing bracket can confuse everything after it, so the first error is the one that matters.

Common JSON errors and how to fix them

Most invalid JSON comes from writing it by hand or copying a JavaScript object literal, which allows more than JSON does. The validator recognises these cases and says so in the hint:

MistakeInvalid exampleFix
Trailing comma[1, 2, 3,]Delete the comma after the last item.
Single quotes{'name': 'Ana'}Use double quotes for keys and strings.
Unquoted key{name: "Ana"}Quote every key: {"name": "Ana"}.
Comment{"a": 1 // note}Remove // and /* */ comments.
Missing comma{"a": 1 "b": 2}Put a comma between members.
Python or JS literal{"ok": True, "x": undefined}Use true, false and null only.
Raw line break in a string"line one line two"Escape it as \n.
Leading zero{"zip": 02134}Write 2134, or store it as the string "02134".

What counts as valid JSON

The validator follows RFC 8259 (the same grammar as ECMA-404). In short:

  • The whole text is one value. Since RFC 7159 that value may be any type, so "hello" and 42 on their own are valid JSON.
  • Whitespace between tokens may only be space, tab, line feed or carriage return. A non-breaking space copied from a web page is an error, and the validator points it out.
  • Numbers are decimal, with an optional minus sign, fraction and exponent. Hex, octal, NaN and Infinity are not allowed.
  • Object keys should be unique. Duplicates are technically allowed but behave unpredictably, so they are reported as warnings rather than errors.

Validate JSON in code

Browsers and runtimes word their parse errors differently, and some only give a character offset. That is why this JSON online validator uses its own strict parser: the message and position are the same in every browser. In your own code, the standard approach is a parse inside error handling:

// JavaScript
function isValidJson(text) {
  try { JSON.parse(text); return true } catch { return false }
}

# Python
import json
try:
    json.loads(text)
except json.JSONDecodeError as e:
    print(e.lineno, e.colno, e.msg)

Valid syntax is not the same as the right shape: to check that required fields exist and have the right types, describe them with a JSON Schema and validate against it. Once the syntax is fixed, the JSON formatter can pretty print the result.

Frequently asked questions

How to validate JSON?

Paste the JSON into the validator above (or open the file) and it is checked as you type: you either see "Valid JSON" or the first error with its line, column and a suggested fix. In code, wrap JSON.parse in try/catch in JavaScript, or use json.loads in Python; both throw on invalid input.

What makes JSON valid?

JSON is valid when it is exactly one value written with the RFC 8259 grammar: objects in braces with double-quoted keys, arrays in brackets, commas only between items, double-quoted strings with escaped control characters, plain decimal numbers, and the lowercase literals true, false and null. Comments, trailing commas, single quotes and values like undefined or NaN make it invalid.

How do I check JSON validity online?

Use an online JSON checker like this one: paste the text and read the result, which updates instantly. This page validates in your browser, so even private API responses or config files are never uploaded to a server.