Developer Tools
Validate JSON and Find Errors
JSON Validator for formatting, validating, converting, or cleaning JSON data in the browser.
Direct Answer
Use the JSON Validator when an API, app, config file, or import says your JSON is invalid. Paste the JSON to check syntax and locate common mistakes such as missing commas, quotes, braces, or brackets.
Common JSON Syntax Errors
Most JSON validation failures come from a small set of recurring mistakes, many of which are valid in JavaScript object literals but not in strict JSON, which trips up people copying code instead of data.
- Trailing commas after the last item in an object or array
- Single-quoted strings instead of double-quoted strings
- Unquoted or single-quoted object keys
- Comments, which are not permitted in strict JSON
- Using NaN, Infinity, or undefined as values, none of which are valid JSON
Errors That Are Harder to Spot Visually
Some invalid JSON looks correct at a glance because the problem is a stray character, an encoding artifact, or a subtlety in how numbers and strings must be written.
- A byte order mark at the start of a file pasted from certain editors
- Leading zeros in numbers, such as 0123, which are not allowed in JSON
- An extra closing brace or bracket left over from editing
- Curly quotes introduced by word processors instead of straight quotes
- A trailing comment or stray character after the final closing brace
How to Use JSON Validator
- Paste or type your content into the input box.
- The transformed result appears instantly in the result panel below.
- Click Copy result to copy the output to your clipboard.
- Download .txt saves the transformed text as a file.
- Reset clears everything and lets you start over.
Reference
| Feature | Details |
|---|---|
| Purpose | Transform pasted text into a cleaner or different format. |
| Input | Text, lines, lists, or copied content. |
| Result | Transformed text ready to copy or download. |
| Best for | Cleanup, formatting, list preparation, and copy-paste workflows. |
| Category | Developer Tools |
| Works on | Desktop, tablet, and mobile browsers |
Useful Related Tools
Frequently Asked Questions
Why does my JSON say "Unexpected token" at a specific position?
This error means the parser hit a character it did not expect while reading valid JSON grammar, most often a comma where a value should be, a missing comma between two entries, or a stray bracket. Look at the character position given in the error and check the token immediately before it, since the actual mistake is often just before the reported location.
Why does my JSON say invalid?
Common reasons include missing commas, trailing commas, unquoted keys, single quotes, comments, unmatched brackets, or invalid values. A validator helps identify the syntax issue.
Why does JSON.parse fail on JSON that looks fine?
Invisible characters are a frequent culprit, especially a byte order mark at the start of the file or a non-breaking space copied from a webpage or PDF, both of which look like normal whitespace but are not. Paste the JSON into a validator that reports the exact character position of the failure to pinpoint it.
Are trailing commas allowed in JSON?
No. Strict JSON does not allow a comma after the last item in an object or array, even though this is valid in JavaScript object and array literals and in relaxed formats like JSON5 or JSONC. Removing the final trailing comma is one of the most common fixes needed when copying JS code as if it were JSON.
Why do my object keys need double quotes?
The JSON specification requires all object keys to be double-quoted strings; single quotes, backticks, and unquoted identifiers are all invalid even though they work in JavaScript object literals. This is the single most common reason JavaScript-style objects fail JSON validation.
Can JSON have comments?
No, the JSON specification has no provision for comments of any kind. If you need comments in a configuration file, consider JSON5, JSONC, or YAML, which support them, and convert to strict JSON only for the parts that need to be machine-read as JSON.
Why does my JSON with a leading zero fail validation, like 0123?
JSON numbers cannot have leading zeros except for the single digit 0 itself, so 0123 is invalid while 123 or 0.123 are fine. This trips up phone numbers, zip codes, and IDs that happen to start with zero; store them as quoted strings instead of numbers if the leading zero is meaningful.
Are NaN and Infinity valid JSON values?
No. JSON has no representation for NaN, Infinity, or -Infinity, even though JavaScript allows these as numeric values. Code that calls JSON.stringify on a value containing NaN or Infinity will silently convert it to null, which can be a source of confusing bugs if you expected an error instead.