What is JSON?
JSON (JavaScript Object Notation) is a lightweight, text-based data format used to store and exchange data between applications, APIs, and services. It is human-readable, easy to write, and supported natively by virtually every modern programming language — making it the universal language of data exchange on the web.
Why JSON Is So Popular
- Human-readable — JSON is easy to read and understand, even without technical expertise
- Language-independent — works with Python, JavaScript, Java, PHP, Go, Ruby, and more
- Lightweight — much smaller and faster to parse than XML
- Native browser support — JavaScript can parse JSON directly with
JSON.parse() - REST API standard — the default format for modern REST APIs and web services
JSON Structure Explained
A JSON document is built from two fundamental structures: objects and arrays.
JSON Object
An object is a collection of key-value pairs enclosed in curly braces. Keys must be strings (in double quotes), and values can be any valid JSON type.
{
"name": "Alice",
"age": 30,
"isActive": true
}
JSON Array
An array is an ordered list of values enclosed in square brackets. Values can be of any type, including other objects or arrays.
[ "apple", "mango", "banana" ]
Nested JSON
JSON supports nesting — objects can contain arrays, and arrays can contain objects, allowing complex data structures.
{
"user": {
"name": "Bob",
"skills": ["JavaScript", "Python"],
"address": {
"city": "New York",
"zip": "10001"
}
}
}
JSON Data Types
String
Text enclosed in double quotes. Example: "Hello World"
Number
Integer or floating-point. Example: 42 or 3.14
Boolean
Either true or false (lowercase, no quotes)
null
Represents an empty or absent value: null
Object
A collection of key-value pairs: {"key": "value"}
Array
An ordered list of values: [1, 2, 3]
Common JSON Errors to Avoid
- Missing commas between key-value pairs
- Single quotes instead of double quotes around keys or strings
- Trailing commas after the last item in an object or array
- Unquoted keys — all keys must be in double quotes
- Comments — JSON does not support comments (
// or /* */)
Use our JSON Validator to catch these errors instantly, or read the full guide on Common JSON Errors.
JSON vs Other Formats
JSON is often compared to XML and YAML. JSON wins on simplicity and performance for most web use cases. Read our detailed JSON vs XML comparison to understand the differences.
How to Work With JSON Online
JSONHack provides a complete set of free browser-based JSON tools:
- JSON Formatter — pretty-print and beautify JSON with proper indentation
- JSON Validator — detect syntax errors instantly
- JSON Minifier — compress JSON for production use
- Base64 Encoder/Decoder — encode JSON strings to Base64 and back
For a step-by-step walkthrough, see How to Format JSON Online.
Paste your JSON and format, validate, or minify it instantly — free and private.