JSON Formatter & Validator
Format, validate, and fix JSON errors instantly. No signup required.
JSON Structure: Objects, Arrays, and Values
JSON is built on two universal structures and six data types. Every piece of valid JSON you will ever see is just a combination of these parts nested together. On the left is a real example that uses every JSON type at once — the labels on the right show what each piece is called.
{
"user": { ← object (nested)
"name": "Ada Lovelace", ← string
"age": 36, ← number
"active": true, ← boolean
"skills": [ ← array
"math",
"cs"
],
"manager": null ← null
}
}
"key": value pairs wrapped in { }. Keys must be unique strings.[ ]. Items can be mixed types."hello".42, 3.14, -7.true or false. No quotes.null means "no value". Not the same as "" or 0.JSON Syntax Rules (The Non-Negotiables)
These are the character-level rules JSON parsers enforce. Break any one of them and JSON.parse() will throw.
Read them once and you'll avoid 95% of "invalid JSON" errors.
-
Keys must use double quotes
"name": "John"is valid. -
Single quotes are invalid
'name': 'John'will fail to parse. -
Separate pairs with commasEach
"key": valuepair is divided by a comma. -
No trailing commasNo comma is allowed after the last item in
{ }or[ ]. -
Use a colon between key and valueAlways
:— never=. -
Keys cannot be unquoted
{ name: "John" }is JavaScript, not JSON. -
Booleans and null are lowercase
true,false,null. -
No
undefined,NaN, orInfinityThese JavaScript values have no JSON equivalent. -
Numbers are never quoted
"age": 36— not"36". -
No comments allowedJSON has no
//or/* */. Strip them before parsing.
Validate Your JSON Instantly
Paste your JSON below. We'll tell you if it's valid and explain any errors in plain English — with the exact line, column, and a human-readable hint. For large documents, use the full formatter at the top.
Correct JSON Format Examples
Real-world JSON file format example snippets you can copy, edit, or load straight into the formatter above. Each template follows every rule in the syntax guide and is ready to use in APIs, config files, or databases.
Valid vs. Invalid JSON
The best way to learn what a valid JSON example looks like is to see it side-by-side with the most common mistakes. Both snippets below contain the same data — only one parses successfully.
{
"name": "Ada Lovelace",
"skills": ["math", "cs"],
"active": true
}
{
'name': "Ada Lovelace",
"skills": ["math", "cs",],
"active": true,
}
'name' uses single quotes, there is a trailing comma after "cs" inside the array, and another trailing comma after true. Any one of these will throw a parse error.
{
"price": 19.99,
"currency": "USD"
}
{
price: 19.99,
"currency": USD
}
price is unquoted, and the value USD is missing its string quotes. JSON keys must always be wrapped in double quotes, and string values must be too.