
When a weather app pulls data from a server or a website sends information to a payment system, the data usually travels in JSON (JavaScript Object Notation). JSON is a plain text format that people can read and computers can process easily. Despite the JavaScript in its name, almost every programming language supports it.
Basic structure
A JSON object starts with a curly brace and consists of key-value pairs. Keys are always written in double quotes. For example, a product could have the value "Pen" for the key "name", 25 for "price", true for "inStock" and the array ["blue", "black"] for "colors".
| Data type | Example | Note |
|---|---|---|
| String | "Pen" | Double quotes required |
| Number | 25 or 12.5 | Written without quotes |
| Boolean | true or false | Lowercase |
| Null | null | Meaning no value |
| Array | ["blue", "black"] | Square brackets |
| Object | Nested curly braces | Hierarchical data |
Where is it used?
- APIs: data exchange between apps; see our API guide.
- Webhook notifications: event details arrive as JSON; see our webhook guide.
- Config files: many apps and tools keep settings in JSON files.
- NoSQL databases: document databases use a JSON-like structure; see our NoSQL guide.
- Data exports: when downloading your data from services.
- 1
Check whether the outermost bracket is an object or an array
- 2
Read the keys in order
- 3
Follow nested objects by indentation
- 4
Note how many items the arrays hold
- 5
Format it with a validator if needed
JSON, XML and CSV compared
| Feature | JSON | XML | CSV |
|---|---|---|---|
| Readability | High | Medium | High (tables) |
| Nested data | Supported | Supported | Not supported |
| Size | Small | Larger | Smallest |
| Typical use | APIs and settings | Documents, older systems | Tables, Excel |
You can bring JSON data into Excel with Power Query; see our Power Query intro guide.
Common mistakes
- Leaving a comma after the last item. JSON doesn't allow trailing commas.
- Using single quotes. Strings and keys need double quotes.
- Adding comments. Standard JSON doesn't support comments.
- Writing True instead of true. Booleans are lowercase.
- Leaving passwords and keys exposed in JSON config files.
Frequently asked questions
Is JSON a programming language? No, it's just a data format.
How do I find broken JSON? Online or code editor validators show the line of the error; don't paste files with sensitive data into unknown sites.
Summary
JSON is the common language of modern software. Once you know objects, arrays and data types, you can read API responses and config files with ease.
Serkan Akyürek is the founder and author of toolrota; he writes step-by-step guides on Excel, AI, the cloud, personal finance and digital security.