What Is JSON? A Five-Minute Guide
JSON is the text format apps use to send data to each other — every API response, many config files, and a lot of what your AI tool writes. How to read it, the six kinds of values it can hold, the mistakes that make it invalid, and where you'll meet it.
If you build apps, you'll see JSON everywhere: in API responses, in configuration files like package.json, in error messages, in database fields. It looks technical, but you can learn to read it in five minutes.
What it is
JSON (JavaScript Object Notation, usually pronounced "jay-son") is a text format for structured data. It's how programs write down information so another program — in any language — can read it back.
Here's a person, in JSON:
{
"name": "Ana Silva",
"age": 34,
"email": "[email protected]",
"isCustomer": true,
"interests": ["photography", "hiking"],
"address": {
"city": "Lisbon",
"country": "Portugal"
},
"phone": null
}
Even if you've never seen JSON, you can probably read that. That's the point: it's structured enough for computers and readable enough for people.
The building blocks
JSON has two ways to group things:
Objects — curly braces { } containing key: value pairs. Like a labelled form.
{ "city": "Lisbon", "country": "Portugal" }
Arrays — square brackets [ ] containing a list of values, in order.
["photography", "hiking", "cooking"]
And six kinds of values:
| Type | Example |
|---|---|
| String (text) | "Ana Silva" — always double quotes |
| Number | 34, 19.99 — no quotes |
| Boolean | true or false — no quotes |
| Null (nothing) | null |
| Object | { "city": "Lisbon" } |
| Array | ["a", "b"] |
Objects and arrays can contain each other, as deeply as needed. An array of objects is very common — for example, a list of orders:
[
{ "id": 101, "total": 49.0, "status": "paid" },
{ "id": 102, "total": 12.5, "status": "refunded" }
]
The rules that trip people up
JSON is strict. These all make it invalid:
- Single quotes.
'name'❌ — must be"name"✅ - Keys without quotes.
{ name: "Ana" }❌ — must be{ "name": "Ana" }✅ - A trailing comma after the last item.
["a", "b",]❌ - Comments.
// like this❌ — standard JSON has no comments. - Missing commas between items, or unmatched brackets.
If you edit a JSON file by hand and something breaks with an error like Unexpected token or JSON.parse: expected ',' or '}', it's almost always one of these. Paste the JSON into an online validator, or ask your AI tool to find the problem.
(Some config files, like tsconfig.json, allow comments because the tool reading them is lenient. Most JSON doesn't.)
Where you'll meet JSON
API responses. When your app asks a service for data, the answer is usually JSON. (What Is an API?) You can see it yourself: in your browser's developer tools, Network tab, click a request and open Response.
Config files. package.json (explained here), tsconfig.json, .vscode/settings.json, Claude Code's settings.json, and many more.
Webhooks. When a service like Stripe notifies your app about an event, it sends JSON. (What Is a Webhook?)
Databases. PostgreSQL can store JSON in a column (jsonb) — handy for flexible data. And NoSQL databases like MongoDB store data in a JSON-like format.
Logs and errors. Many tools log in JSON so logs can be searched.
Reading JSON in code
In JavaScript, converting between JSON text and usable data is one line each way:
const data = JSON.parse('{"name": "Ana", "age": 34}') // text → data
data.name // "Ana"
const text = JSON.stringify({ name: "Ana", age: 34 }) // data → text
Other languages have the same: Python's json.loads and json.dumps, for example.
Tips
- Pretty vs minified: JSON can be on one long line (small, for computers) or indented (readable, for people). Same data. Most editors can format it: in VS Code, "Format Document."
- Big responses are easier to read in the browser. Most browsers display JSON URLs as a collapsible tree.
- Don't put secrets in JSON config files that get committed to git. Use environment variables. (What Is an Environment Variable?)
The summary
- JSON is text for structured data: objects
{ }of key-value pairs, arrays[ ]of values. - Values: strings (double quotes), numbers,
true/false,null, objects, arrays. - It's strict: double quotes, quoted keys, no trailing commas, no comments.
- You'll see it in APIs, config files, webhooks, and databases.
EasySpawn gives Claude Code a workspace where it can call your APIs and read the real JSON responses, rather than guessing their shape. See how it works or join the waitlist.
Related: What Is an API? · What Is a Webhook? · What Is Markdown?
Keep reading
What Is React? A Beginner's Guide to the Library Behind Most AI-Built Apps
Lovable, Bolt, v0, and Claude Code all tend to produce React. What React is, what components, props, and state mean, how to read a .jsx file, what hooks like useState and useEffect do, and the React mistakes AI tools make most often.
What Is Node.js? JavaScript Outside the Browser, Explained
Node.js lets JavaScript run on servers and on your computer, and it's behind npm, most AI-built backends, and tools like Claude Code's ecosystem. What Node.js is, what it's used for, LTS versions, how to install it properly, and the errors beginners hit first.