What Is JSON? A Beginner's Guide With Examples
If you've touched an API, a config file, or modern web development at all, you've met JSON. It's the de facto format for exchanging data between systems — readable enough for humans, strict enough for machines. Here's a beginner-friendly tour of what it is and how to work with it.
What JSON is
JSON stands for JavaScript Object Notation. Despite the name, it's language-independent — virtually every programming language can read and write it. It represents data as key–value pairs and ordered lists, which together can describe almost any structured data.
A simple example
{
"name": "Ada Lovelace",
"age": 36,
"isMathematician": true,
"languages": ["English", "French"]
}
That's an object with four keys. Notice the data types: a string in quotes, a number, a boolean, and an array of strings. JSON supports strings, numbers, booleans, null, objects, and arrays — that's the whole vocabulary.
The rules that trip people up
- Keys must be in double quotes — single quotes are invalid.
- No trailing commas — a comma after the last item breaks it.
- No comments — JSON has no comment syntax (a frequent surprise).
- Strings use double quotes only, never single.
These small rules cause most "invalid JSON" errors. The official grammar is defined at json.org.
How to read and fix messy JSON
APIs return JSON minified onto one line, which is unreadable. Paste it into our JSON formatter to get clean, indented output — and an instant error message pinpointing any syntax mistake. It's the fastest way to debug a malformed payload.
Where you'll meet JSON
API responses, configuration files (like package.json), the payload of a JWT, NoSQL databases, and browser localStorage all use JSON. Once you can read it comfortably, a huge amount of modern tooling opens up.
JSON vs XML
JSON largely replaced XML for web APIs because it's lighter and easier to read. XML still appears in some enterprise and document contexts, but for new web work, JSON is the default. If you need to move between formats, our converters handle that too.
Bottom line
JSON is a simple, universal way to represent structured data with keys, values, and arrays. Learn the handful of strict rules — double quotes, no trailing commas, no comments — and lean on a formatter to validate and tidy it. It's one of the most useful formats to be fluent in. For more everyday helpers, see our web developer toolkit.