What is JSON? A Beginner-Friendly Guide
JSON (JavaScript Object Notation) is the most widely used data-interchange format on the internet. When a web app talks to its backend, when a mobile app talks to an API, when a microservice publishes an event — there's a very good chance JSON is on the wire. This guide explains what JSON is, how it's structured, and why it became the default.
A format designed to be simple
JSON was created by Douglas Crockford in the early 2000s as a way to pass structured data between a browser and a server. It was deliberately minimal: six data types, two composite structures, and a grammar you can read through in a single afternoon. That simplicity is what made it win — JSON is trivial to parse in every programming language, and a human reading it can understand the data without reaching for a tool.
The data types
- Strings — double-quoted UTF-8 text, with backslash escapes for special characters.
- Numbers — integers or floats, no distinction in the spec itself.
- Booleans —
trueorfalse. - Null — the literal
null. - Arrays — ordered lists, written with square brackets:
[1, 2, 3]. - Objects — unordered key/value maps, written with braces:
{ "key": "value" }.
Arrays and objects can contain any of the six types, including other arrays and objects, which is how JSON represents arbitrarily nested data.
A minimal example
{
"name": "Ada Lovelace",
"born": 1815,
"fields": ["mathematics", "computing"],
"published": true,
"bio": null
}This object captures five fields of different types. A parser reads the bytes on the left and hands your program a native data structure on the right — a dictionary in Python, an object in JavaScript, a struct in Go, a case class in Scala. No custom deserializer required.
Why JSON won
XML was the dominant format for most of the 1990s and 2000s, but it was verbose, required schemas to be really useful, and had a heavy ceremony around namespaces and attributes. JSON took off because:
- It maps one-to-one with the data structures used in most programming languages.
- The syntax is a strict subset of JavaScript, so browsers parse it for free.
- It's typically 30–50% smaller on the wire than equivalent XML.
- Tooling is ubiquitous — every language has a built-in or one-line dependency for reading and writing JSON.
Where JSON is used today
Pretty much everywhere there's data moving between systems. REST APIs return JSON. GraphQL returns JSON. Config files (package.json, tsconfig.json, composer.json) are JSON. NoSQL databases like MongoDB and Couchbase store documents that are effectively JSON. Logging pipelines ship JSON lines. Browser localStorage values are typically stringified JSON.
When to reach for something else
JSON isn't always the right answer. For configuration files humans will edit often, YAML is friendlier because it supports comments and less noisy syntax. For very high-volume binary payloads, Protocol Buffers or MessagePack are more efficient. For tree-shaped documents that need attributes, XML is still a reasonable choice.
Try it yourself
Paste any JSON document into the JSON Formatter to see it pretty-printed with syntax-aware indentation, or into the JSON Validator to catch syntax errors with precise line and column numbers. If you want to inspect a complex payload visually, the Tree Viewer renders JSON as a collapsible interactive tree.
Once you've seen a few JSON documents and poked at them with tools, the format stops being mysterious and starts feeling like what it really is: a convenient, unambiguous way to move data between programs.