What Is JSON?
When software systems exchange information, they need a common language. You can't just send raw thoughts between programs — you need structure. JSON (JavaScript Object Notation) has become the universal format for this structured data exchange.
JSON looks like organized text with a specific pattern. It's human-readable, so you can open a JSON file and understand what's inside. It's also machine-parseable, meaning programs can quickly extract exactly the data they need.
Key-Value Pairs
The foundation of JSON is the key-value pair. A key is a label, and a value is the data associated with that label:
{ "name": "Alice", "age": 30, "city": "Portland" }
Keys are always strings in quotes. Values can be strings, numbers, booleans (true or false), or null. Think of it like a form with labeled fields — each field has a name and a value you fill in.
Arrays: Lists of Things
Sometimes you need a list of items. JSON handles this with arrays, which use square brackets:
["apple", "banana", "cherry"]
Arrays can contain any type of value, including other arrays or objects. They're perfect for collections like a list of products, a series of messages, or multiple search results.
Nesting: Data Inside Data
JSON becomes powerful when you nest structures inside each other:
{
"user": {
"name": "Alice",
"contacts": ["bob@email.com", "carol@email.com"]
}
}
This is like nested folders on your computer — a folder can contain other folders, which contain files. You can represent complex, hierarchical information in a clean, readable way.
Where You'll See JSON
JSON appears almost everywhere in modern development. APIs send and receive JSON. Config files often use JSON format. Databases store JSON documents. When you inspect network traffic in your browser, you'll see JSON flowing between your browser and servers.
The format originated from JavaScript, but every major programming language can read and write JSON. This universality is why it became the standard for data exchange on the web.