# JSON validator

URL: https://shahid09.is-a.dev/tools/json-validator/
Author: Muhammad Shahid (https://shahid09.is-a.dev/)
Free tool · runs in your browser

Check whether JSON is valid, and find the exact line, column and reason when it is not.

**Quick answer:** Paste your JSON to check it against the RFC 8259 standard. If it is invalid, you see the line and column and a plain explanation, such as a trailing comma or single quotes. If it is valid, you see its size, nesting depth and counts of keys and values, plus a warning for any duplicate keys, which are legal but risky. Nothing is uploaded.

## How to use it

1. **Paste your JSON.** Results update as you type.
2. **Read the verdict.** Valid, or the line, column and reason for the first error.
3. **Fix and repeat.** Fix that error and check again, as one error can hide others.

## Example

A trailing comma, which JavaScript allows but JSON does not:

Input:

```
{
  "name": "Sara",
  "age": 30,
}
```

Output:

```
Line 4, column 1
Trailing comma: remove the comma before this closing brace.
```

## Common errors and how to fix them

- **Trailing comma**: Remove the comma after the last item in an object or array.
- **Strings must use double quotes**: Replace 'single' with "double" quotes, on both keys and values.
- **Keys must be in double quotes**: Write {"name": 1}, not {name: 1}.
- **Unexpected text after the end of the JSON**: Only one top-level value is allowed. Wrap several objects in an array, or check for NDJSON (one object per line).

## Frequently asked questions

### What are the most common JSON errors?

Trailing commas, single quotes instead of double quotes, keys without quotes, missing commas between items, and comments. All are valid in JavaScript objects, but not in JSON.

### Are trailing commas allowed in JSON?

No. RFC 8259 does not allow them, even though JavaScript does. Remove the comma before } or ].

### Can JSON have comments?

No. Standard JSON has no comments. Formats such as JSONC and JSON5 allow them, but ordinary JSON parsers reject them.

### Are duplicate keys valid?

They are allowed by the grammar, but the standard warns against them, as results vary. Most parsers keep only the last value, which can silently lose data.

### How is this different from the JSON formatter?

This tool focuses on finding problems, with explanations and statistics. The [JSON formatter](https://shahid09.is-a.dev/tools/json-formatter/) makes valid JSON readable or compact.

### Why does True or None fail?

Those are Python spellings. JSON uses lowercase true, false and null.

### Does it validate against a JSON Schema?

No. It checks that the syntax is valid JSON, not whether the data has the fields you expect.

### Is my data sent anywhere?

No. It is checked in your browser, so it is safe for API responses and configuration files.

### How do I make valid JSON readable?

Use the JSON formatter, which adds indentation or makes it compact.

### Can JSON be just a number or a string?

Yes. RFC 8259 allows any JSON value at the top level, not only objects and arrays.

## Related

- [JSON formatter](https://shahid09.is-a.dev/tools/json-formatter/)
- [JWT decoder](https://shahid09.is-a.dev/tools/jwt-decoder/)
- [AI tool schema generator](https://shahid09.is-a.dev/tools/ai-tool-schema-generator/)

## Sources

- [RFC 8259: JSON](https://www.rfc-editor.org/info/rfc8259)
