My JSON is invalid and I can't find the error
'Unexpected token' almost always means one stray character. A validator points straight at it so you're not hunting by eye.
When JSON is invalid, a validator finds the exact spot: paste it in and it flags the line and reason, usually a trailing comma, a missing quote or bracket, or single quotes instead of double. Fix that character, then format it to make the structure obvious. Our JSON Validator and Formatter run in your browser on your data.
4 tools for this
Each one is free, private and runs in your browser. No sign-up, no watermark.
JSON Validator
Validate JSON against RFC 8259 with the exact error line, column and a caret under the bad character. Get plain-English explanations, one-click auto-fix for trailing commas and single quotes, plus depth, key-count and type stats, nothing uploaded.
JSON Formatter
Format, validate and minify JSON in your browser with pinpoint error line + column, jump-to-error, key sorting and live editing: nothing is uploaded.
JSON Tree Viewer
Explore JSON as an interactive, collapsible tree. Expand or collapse any branch, see type and array-length badges, search keys and values with live highlighting, and copy any node's value or its JSONPath in one click, all 100% in your browser.
JSON Diff
Compare two JSON documents by structure, not text. Reordered keys and whitespace are ignored. You see added, removed and changed values by path with counts, all in your browser.
How to fix it
Follow these steps and you'll have it sorted in a couple of minutes.
- 1
Paste your JSON into the validator
The JSON Validator parses it in your browser and reports the first error with its line and column.
- 2
Fix the flagged character
The usual suspects: a trailing comma, an unquoted key, single quotes, or a missing } or ].
- 3
Format to reveal the structure
Run the JSON Formatter to indent it, mismatched nesting becomes obvious at a glance.
- 4
Re-validate until it's clean
Repeat until the validator reports valid, then use the Tree Viewer to sanity-check the shape.
- Trailing commas after the last item in an object or array, valid in JavaScript, invalid in JSON.
- Using single quotes. JSON requires double quotes around both keys and string values.
- Pasting a JavaScript object or a JSONC file with comments: JSON doesn't allow comments or unquoted keys.
Frequently asked questions
More problems we solve
Ran into one of these too? Here's the fix.
- I need to convert a CSV file to JSONMove data between a spreadsheet and code without a script. Header row becomes keys, each row becomes an object.
- My code or data is minified and unreadableOne long line of minified everything? Pick the matching formatter and get properly indented, readable code back.
- My site has no meta tags or preview when sharedA blank preview costs you clicks. Add the right tags so Google and social show a proper title, description and image.
Keep exploring
Problems we solve
From the blog
- JSON-LD vs. Microdata vs. RDFa: Which Structured Data Format Should You Use?
- How to Convert CSV to JSON: Headers, Types, and Nesting Done Right
- What Is JSON and How to Read It: A Beginner's Guide
- How to Generate TypeScript Types from JSON (API Responses Made Type-Safe)
- Base64 Encoding Explained: What It Is and When to Use It
Compare formats
By file type
Common tasks
Ready? Start with JSON Validator
Free, private and instant: everything runs in your browser.