Validate JSON
JSON Validator is a free syntax checker that runs entirely in your browser. Paste or type JSON below — errors are highlighted instantly with line and column numbers.
Common JSON Errors and How to Fix Them
Most JSON validation failures come from a handful of mistakes. Here are the six most common errors, each with a wrong and correct example.
1. Trailing Commas
JSON forbids a comma after the last item.
// ✗ Invalid
{"a": 1, "b": 2,}
// ✓ Valid
{"a": 1, "b": 2}
2. Single Quotes
Keys and string values must use double quotes.
// ✗ Invalid
{'name': 'Jo'}
// ✓ Valid
{"name": "Jo"}
3. Unquoted Keys
Every key must be a double-quoted string.
// ✗ Invalid
{name: "Jo"}
// ✓ Valid
{"name": "Jo"}
4. Comments
JSON does not support comments of any kind.
// ✗ Invalid
{"name": "Jo" /* user */}
// ✓ Valid
{"name": "Jo"}
5. Missing Brackets
Every { needs a } and every [ needs a ].
// ✗ Invalid
{"items": [1, 2, 3}
// ✓ Valid
{"items": [1, 2, 3]}
6. Using undefined
undefined is not a JSON value. Use null.
// ✗ Invalid
{"value": undefined}
// ✓ Valid
{"value": null}
What Is JSON?
JSON (JavaScript Object Notation) is a lightweight text format for storing and exchanging structured data. It is the standard data format for web APIs, configuration files, and data interchange between services.
A valid JSON document is either an object ({}) or an array ([]) at the top level. Values inside can be strings, numbers, booleans (true/false), null, objects, or arrays.
JSON Data Types at a Glance
| Type | Example | Notes |
|---|---|---|
| String | "hello" | Must use double quotes |
| Number | 42, 3.14, -1 | No leading zeros, no hex |
| Boolean | true, false | Lowercase only |
| Null | null | Lowercase only |
| Array | [1, 2, 3] | Ordered list of values |
| Object | {"k": "v"} | Unordered key-value pairs |
Syntax Validation vs. Schema Validation
Syntax validation (what this tool does) checks whether the text is well-formed JSON — correct brackets, proper quoting, no trailing commas.
Schema validation goes further. It checks whether valid JSON matches a specific structure — required fields, data types, string patterns, numeric ranges. Tools like JSON Schema are used for this.
Frequently Asked Questions
What is a JSON validator?
A JSON validator checks whether a piece of text follows the JSON syntax rules defined in RFC 8259. It catches errors such as missing commas, unquoted keys, trailing commas, and mismatched brackets — then tells you the exact line and position of the problem.
What makes JSON invalid?
Common causes: single quotes instead of double quotes, trailing commas after the last item, unquoted property names, comments (JSON does not allow them), using undefined instead of null, and mismatched or missing brackets or braces.
Does JSON allow comments?
No. The JSON specification does not permit comments. If you need comments in a configuration file, consider JSONC (JSON with Comments), JSON5, or YAML. Strip comments before sending data to an API.
Does JSON allow trailing commas?
No. A comma after the last element in an array or the last property in an object makes the JSON invalid. For example, {"name": "Jo",} will fail. Remove the trailing comma to fix it.
Is this validator safe for sensitive data?
Yes. Validation runs entirely in your browser using the built-in JSON.parse() function. Your data is never sent to a server.
What is the difference between JSON and JSONC?
JSONC (JSON with Comments) is an extension that allows single-line (//) and multi-line (/* */) comments. It is used by VS Code for settings files but is not valid standard JSON.
Can JSON keys be numbers?
Keys must always be strings in double quotes. You can use a numeric string — {"1": "value"} is valid — but a bare number as a key is not.
Is there a size limit for JSON?
The specification defines no limit. Practical limits depend on the parser and available memory. Browser-based parsing typically handles files up to several hundred megabytes, though performance drops with very large inputs.
Can a JSON file contain just a string or number?
Yes. RFC 8259 allows any JSON value at the top level, including a bare string ("hello"), number (42), boolean, or null. However, most APIs expect an object or array.
How do I fix "Unexpected token" errors?
This error means the parser hit a character it didn't expect. Check the reported line and column: look for missing quotes, extra commas, or characters like single quotes or comments that JSON doesn't allow. The sample buttons above let you see common examples.
Related Tools
- JSON Formatter — beautify and indent JSON for readability
- JSON to CSV Converter — convert JSON arrays to CSV
- JSON to XML Converter — transform JSON into XML
- JSON Diff Viewer — compare two JSON documents
- YAML ↔ JSON Converter — switch between YAML and JSON
Privacy & Limitations
- All calculations run entirely in your browser -- nothing is sent to any server.
- Results are computed locally and should be verified for critical applications.
Related Tools
View all toolsBig-O Notation Visualizer
Interactive plot of O(1) through O(n!) complexity curves with operation count comparison
JSON Formatter
Format and beautify JSON with proper indentation
CSV to JSON Converter
Convert CSV data to JSON format with auto-detection
JSON to CSV Converter
Convert JSON arrays to CSV format with nested object handling
JWT Decoder
Decode JWT tokens and display header and payload
Hash Generator
Generate MD5, SHA-1, SHA-256, SHA-512 hashes
JSON Validator FAQ
What is a JSON validator?
A JSON validator checks whether a piece of text follows the JSON (JavaScript Object Notation) syntax rules. It catches errors such as missing commas, unquoted keys, trailing commas, and mismatched brackets — then tells you the exact line and position of the problem.
What makes JSON invalid?
Common causes of invalid JSON include: single quotes instead of double quotes, trailing commas after the last item, unquoted property names, comments (JSON does not allow them), using undefined instead of null, and mismatched or missing brackets or braces.
Does JSON allow comments?
No. The JSON specification (RFC 8259) does not permit comments. If you need comments in a configuration file, consider JSONC (JSON with Comments) or YAML instead. Before sending data to an API, strip any comments.
Does JSON allow trailing commas?
No. A comma after the last element in an array or the last property in an object makes the JSON invalid. For example, {"name": "Jo",} will fail validation. Remove the trailing comma to fix it.
Is this validator safe to use with sensitive data?
Yes. Validation runs entirely in your browser using the built-in JSON.parse() function. Your data is never sent to a server.
What is the difference between JSON validation and JSON schema validation?
Syntax validation checks whether the text is well-formed JSON. Schema validation goes further — it checks whether the JSON structure matches a specific schema (required fields, data types, value constraints). This tool performs syntax validation.
Can JSON keys be numbers?
JSON keys must always be strings enclosed in double quotes. You can use a number inside the string — {"1": "value"} is valid — but an unquoted number as a key is not valid JSON.
What is the maximum size of a JSON file?
The JSON specification does not define a size limit. Practical limits depend on the parser and available memory. Browser-based parsing with JSON.parse() typically handles files up to several hundred megabytes, though performance degrades with very large inputs.