What Is JSON? A Complete Guide
JSON (JavaScript Object Notation) is a lightweight data format for storing and exchanging data. Here's everything you need to know.
The Basics
Full name
JavaScript Object Notation
Pronunciation
"JAY-son" (like the name Jason)
Created by
Douglas Crockford, early 2000s
Standard
RFC 8259
Language support
Python, Java, Go, Ruby, C#, and every major language
File extension
.json
JSON Syntax Rules
- 1
Data is in key/value pairs — keys must be double-quoted strings
- 2
Data is separated by commas
- 3
Objects use curly braces
{} - 4
Arrays use square brackets
[] - 5
No trailing commas allowed
- 6
No comments allowed (use
"_comment"key as workaround)
Valid example
{
"name": "Alice",
"age": 30,
"active": true,
"score": 9.5,
"address": null,
"tags": ["dev", "admin"]
}JSON Data Types
String
"hello"Always double quotes
Number
42 / 3.14Integer or float, no quotes
Boolean
true / falseLowercase only
Null
nullRepresents empty/unknown
Array
[1, "a", true]Ordered list, mixed types OK
Object
{"key": "val"}Key-value pairs, keys must be strings
JSON vs Other Formats
JSON vs YAML
YAML is more human-friendly for config; JSON is better for APIs.
Common JSON Mistakes
Use single quotes — {'name': 'Alice'} ❌
Leave trailing commas — {"a": 1,} ❌
Add comments — // this fails ❌
Use undefined — not a valid JSON value ❌
Use double quotes for all keys and strings ✓
Validate with a JSON formatter before using ✓
JSON Special Values
Booleans
true and false — lowercase only. True, False, and TRUE are all invalid JSON.
Null
null represents an absent or unknown value. It is distinct from 0, false, and "" — each has a different semantic meaning.
Dates
JSON has no native date type. Common approaches: ISO 8601 string, Unix timestamp, or a custom format. Always agree on a format with your API.
ISO 8601 (recommended)
"2024-01-15T10:30:00Z"Unix timestamp
1705312200Custom format
"2024-01-15"Escape Characters
Special characters inside JSON strings must be escaped with a backslash.
| Sequence | Meaning |
|---|---|
\" | double quote |
\\ | backslash |
\n | newline |
\t | tab |
\/ | forward slash (optional) |
Work with JSON — Free Online Tools
Validate and format your JSON instantly
Free, browser-based, no sign-up. Your data never leaves your device.