JSON Formatter & Validator
Format, validate and minify JSON instantly with syntax highlighting and precise error location. Runs 100% in your browser — nothing is uploaded.
Why use a JSON formatter
Malformed JSON is one of the most common causes of failing builds and broken API calls. This tool validates your JSON, pinpoints the exact character where parsing fails, and formats it to your preferred indentation style.
Features
- Syntax highlighting for keys, strings, numbers, booleans and nulls
- Error location with line and column numbers
- Minify mode for production payloads
- Choose your indentation — 2 spaces, 4 spaces, tabs, or none
- 100% client-side — your data never leaves your browser
Common JSON errors
| Error | Cause | Fix |
|---|---|---|
Unexpected token | Trailing comma or missing quote | Remove the comma before } or ] |
Unexpected end of JSON input | Unclosed bracket or brace | Match every { with a } |
Invalid escape character | Single backslash in a string | Use \\ for a literal backslash |
Unexpected token in JSON | Single quotes instead of double | JSON requires double quotes |
Bad control character | Literal newline inside a string | Escape it as \n |
The most common mistake
Trailing commas. JavaScript objects allow them, JSON does not:
{
"name": "toolnest",
"tags": ["free", "fast"], <-- this comma is invalid
}
The error message tells you the exact line and column, which is usually enough to find it in a large payload.
Tips for working with large payloads
Most browsers handle a few megabytes of JSON without trouble. If the formatter feels slow, minify the output instead of pretty-printing it.
For very large files in a development workflow, jq on the command line is faster:
jq . data.json # pretty print
jq -c . data.json # minify
jq '.users[0].email' data.json
Related
Use the Base64 encoder to encode the payload for a URL or header, or decode a JSON Web Token to inspect its claims.
Frequently asked questions
Is my JSON uploaded anywhere?
No. The entire tool runs in your browser using JavaScript. Your payload is never sent to a server.
Can it handle large JSON files?
Yes, up to a few megabytes. For very large files, pretty-printing may feel slow but still works.
How do I fix a trailing comma error?
Delete the comma that appears immediately before a closing } or ]. JSON does not allow trailing commas.
Does it support JSON Lines (NDJSON)?
Yes — paste multiple JSON objects on separate lines and each will be validated and formatted independently.
Why does my valid JavaScript object fail?
JSON is stricter than JavaScript. Object keys must be double-quoted, single quotes are not allowed, comments are not allowed, and trailing commas are invalid.