JSON Formatting Guide for Beginners: How to Read, Write and Validate JSON
JSON is the universal data format for APIs and web apps. Learn how to read it, write it correctly, and validate it without any programming knowledge.
What is JSON?
JSON stands for JavaScript Object Notation. Despite the name, it's not just for JavaScript — it's the universal standard for data exchange between web services, APIs, and applications.
If you've ever looked at an API response, a configuration file, or a data export, you've probably seen JSON. It looks like this:
{
"name": "John Smith",
"age": 32,
"email": "john@example.com",
"active": true,
"tags": ["developer", "designer"]
}
Why JSON Matters
JSON is used everywhere:
- APIs — almost every web API returns JSON responses
- Configuration files — package.json, settings files, VS Code config
- Data exports — many apps export data as JSON
- Databases — MongoDB, Firestore, and others store JSON natively
- Web communication — browsers and servers send JSON back and forth constantly
JSON Structure: The 6 Rules
JSON has exactly 6 data types:
1. String — text in double quotes
"Hello, world"
2. Number — integers or decimals, no quotes
42
3.14
3. Boolean — true or false, lowercase, no quotes
true
false
4. Null — represents nothing/empty
null
5. Array — ordered list of values in square brackets
["apple", "banana", "cherry"]
6. Object — key-value pairs in curly braces
{
"key": "value",
"another_key": 123
}
Objects and arrays can be nested inside each other to any depth.
Common JSON Formatting Errors
Missing comma between properties
// WRONG
{
"name": "John"
"age": 32
}
// CORRECT
{
"name": "John",
"age": 32
}
Trailing comma (not allowed in JSON)
// WRONG
{
"name": "John",
"age": 32,
}
Single quotes instead of double quotes
// WRONG
{
'name': 'John'
}
// CORRECT
{
"name": "John"
}
Unquoted keys
// WRONG
{
name: "John"
}
How to Validate and Format JSON Online
When JSON arrives as a compressed single line, it's nearly impossible to read. A JSON formatter:
- Validates that the JSON is syntactically correct
- Adds indentation and line breaks to make it readable
- Highlights errors with clear messages
Format and validate JSON free →
Just paste your JSON, click Format, and the tool will either show you the pretty-printed result or highlight exactly where the error is.
Reading Nested JSON
Real-world JSON is often deeply nested. Here's how to read it:
{
"user": {
"id": 1001,
"profile": {
"name": "Alice",
"location": "London"
},
"orders": [
{ "id": "ORD-001", "total": 49.99 },
{ "id": "ORD-002", "total": 129.00 }
]
}
}
To access the user's name: follow user → profile → name
To access the first order total: follow user → orders → first item → total
Converting JSON to Other Formats
Need your JSON data in a spreadsheet? Convert it to CSV instantly — no programming required.
Or going the other way — if you have a CSV file you need as JSON: