What is JSON?
JSON is a simple text format for storing and exchanging data. It is easy for people to read and for software to understand, and is used by almost every app and website.
JSON Data Types
| Type | Example |
|---|---|
| String | "hello world" |
| Number | 42, 3.14, -7 |
| Boolean | true, false |
| Null | null |
| Object | {"key": "value"} |
| Array | [1, 2, 3] |
Common JSON Errors
| Error | Cause | Fix |
|---|---|---|
| Unexpected token | Missing comma or bracket | Add the missing , or } |
| Unexpected string | Trailing comma | Remove last comma |
| Unexpected end | Unclosed bracket | Close all { } [ ] |
| Invalid key | Key not in quotes | Wrap keys in " " |
| Single quotes | Used ' instead of " | Replace all ' with " |
| Undefined/NaN | JS value not valid in JSON | Use null instead |
JSON vs a Plain Object
JSON keys must always be in double quotes. JSON does not allow comments, functions, undefined or NaN. Always check your JSON before sending it anywhere.
How It Works
This tool checks your text, then formats valid JSON with the indentation you choose. If the JSON is invalid, it tells you what is wrong. Nothing is saved or shared.