JSON Validator & Formatter

Paste your JSON to validate syntax, find errors with exact positions, and get beautifully formatted output in one click.

Ctrl+Enter to validate

Need 4 spaces, tabs, minified output or sorted keys? The JSON Formatter does that in your browser and keeps every number exactly as written. To explore a large document, the JSON Viewer shows it as a tree you can search, and the JSON Compare tool shows what changed between two versions.

Instant Validation

Validate your JSON in milliseconds. Get clear error messages with exact line and column numbers to fix issues fast.

Auto Formatting

Valid JSON is automatically formatted with proper indentation. Compare input and output size side by side.

Copy & Share

Copy formatted JSON with one click. Perfect for cleaning up API responses, config files, and data payloads.

What Is JSON?

JSON (JavaScript Object Notation) is a lightweight data interchange format. It is easy for humans to read and write, and easy for machines to parse and generate. JSON is the most widely used format for APIs, configuration files, and data storage on the web.

A valid JSON document must follow strict syntax rules: strings must use double quotes, there are no trailing commas, keys must be quoted, and only specific value types are allowed (strings, numbers, booleans, null, arrays, and objects). Unlike JavaScript, JSON does not support comments, single quotes, or undefined values.

Because JSON syntax is strict, even a single misplaced character will make the entire document invalid. A JSON validator helps you find these issues instantly, saving time when debugging API responses, configuration files, or data exports.

Common JSON Errors

Unexpected Token

The parser stopped at a character it cannot accept there. It names the position, not the cause: the real mistake is usually a trailing comma, a single quote or an unquoted key just before it.

{"a": 1,}          // Unexpected token }
{"a": 1}           // valid
How to fix unexpected token →

Trailing Commas

JSON does not allow a comma after the last item in an array or object. [1, 2, 3,] is invalid. Remove the trailing comma.

["a", "b", "c",]  // invalid
["a", "b", "c"]   // valid
How to fix trailing commas →

Single Quotes

JSON requires double quotes for strings and keys. Single quotes are not valid. 'hello' must be "hello".

{'name': 'John'}  // invalid
{"name": "John"}  // valid
How to fix single quotes →

Missing Quotes on Keys

All keys in JSON objects must be double-quoted strings. Unquoted keys are valid in JavaScript but not in JSON.

{name: "John"}    // invalid
{"name": "John"}  // valid
How to fix missing quotes on keys →

Missing Comma

Every pair in an object and every item in an array is separated by a comma. Leaving one out is the mirror of leaving one too many.

{"a": 1 "b": 2}   // invalid
{"a": 1, "b": 2}  // valid
How to fix missing comma →

Unclosed Bracket

Every { and [ needs its partner. The parser only notices at the end of the file, so the reported position is rarely where the mistake is.

{"a": {"b": 1}    // invalid
{"a": {"b": 1}}   // valid
How to fix unclosed bracket →

Comments

JSON does not support comments of any kind. Neither // single-line nor /* multi-line */ comments are allowed.

{
  // name
  "name": "John"
}  // invalid
How to fix comments →

Unescaped Special Characters

Strings containing backslashes, quotes, or control characters must be properly escaped with a backslash.

{"path": "C:\Users"}  // invalid
{"path": "C:\\Users"} // valid
How to fix unescaped special characters →

Wrong Boolean/Null Casing

JSON booleans and null must be lowercase: true, false, null. True, False, None, NULL are all invalid.

{"active": True}   // invalid
{"active": true}   // valid
How to fix wrong boolean/null casing →

Browse every JSON error guide for the rest, each with the wrong and right version side by side.

Why Valid JavaScript Is Not Valid JSON

Most invalid JSON was written as a JavaScript object, or copied from a config file that allows more than JSON does. JSON is defined by RFC 8259 and is much stricter than either:

Allowed in JavaScriptIn JSON
{ name: 1 }Keys must be double-quoted strings.
{ 'a': 'b' }Strings use double quotes only.
[1, 2, 3,]No trailing comma, in arrays or objects.
// a commentNo comments of any kind. JSONC and JSON5 allow them; JSON does not.
undefined, NaN, InfinityNot values. JSON has strings, numbers, true, false, null, arrays and objects.
0x1F, 012, .5Numbers are decimal, with no leading zero and a digit before the point.

Valid JSON Can Still Lose Data

Two things pass validation and still bite later. Large integers: JSON puts no limit on numbers, but JavaScript stores them as 64-bit floats, so an id like 12345678901234567890 comes back as 12345678901234567000 once parsed. Repeated keys: RFC 8259 says names should be unique, not must, so a document with the same key twice is valid, and most parsers silently keep only the last value.

To reformat JSON without either problem, the JSON formatter prints every number and key exactly as written and reports repeated keys. When validation fails, the JSON error guides show the fix for each message, starting with the most searched one, unexpected token.

Frequently Asked Questions

What does a JSON validator check?
A JSON validator checks that your JSON follows the correct syntax: properly quoted keys and strings, valid data types, correct nesting of objects and arrays, no trailing commas, no comments, and no single quotes. If any rule is broken, the validator reports the exact location of the error.
What is the difference between JSON and JavaScript objects?
JSON is a stricter subset of JavaScript object syntax. In JSON, all keys must be double-quoted strings, all string values must use double quotes, trailing commas are forbidden, comments are not allowed, and only specific value types (string, number, boolean, null, array, object) are permitted. JavaScript objects are more flexible and support all of these.
Why is my JSON invalid even though it works in JavaScript?
JavaScript is more lenient than JSON. Common issues include using single quotes instead of double quotes, having trailing commas, using unquoted keys, including comments, or using JavaScript-specific values like undefined or NaN. All of these are valid JavaScript but invalid JSON.
How do I fix a JSON parsing error?
First, use a JSON validator to find the exact line and column of the error. Common fixes include: replacing single quotes with double quotes, removing trailing commas, quoting all keys, removing comments, escaping special characters in strings, and using lowercase true/false/null.
Is this JSON validator free to use?
Yes, our JSON validator is completely free with no limits or registration required. Paste your JSON, validate it, and get formatted output as many times as you need.
Can I validate large JSON files?
Yes. Our validator can handle large JSON documents. For very large files (over 1MB), validation may take a moment, but there is no hard limit. The formatted output preserves the full structure with proper indentation.
What is JSON Lint?
JSON Lint is the process of validating JSON syntax, similar to how a code linter checks programming languages for errors. Our JSON validator acts as a JSON linter, checking syntax and providing clear error messages with exact positions.

Related Tools