Programming · data · web
What is JSON?
Open almost any web API response, a JavaScript config file, or a modern app's saved settings, and you will see JSON. It is the format that quietly carries most of the structured data moving around the internet. This guide explains what JSON is, its small syntax, why it took over, how it compares to XML, and where it falls short.
The short definition
JSON (JavaScript Object Notation) is a lightweight, text-based format for representing structured data. It is easy for humans to read and easy for machines to parse, and despite the name it is language-independent — practically every programming language can read and write it.
The syntax, in one example
JSON is built from a handful of value types: objects, arrays, strings, numbers, booleans and null. An object is a set of key–value pairs in braces; an array is an ordered list in brackets:
{
"name": "Ada",
"age": 36,
"active": true,
"roles": ["admin", "author"],
"address": { "city": "London", "zip": "EC1" }
} That is essentially the whole format. Keys are always strings in double quotes; values can themselves be objects or arrays, so JSON nests to any depth. There are no functions, no variables and no logic — it describes data, nothing more.
Why JSON is everywhere
- APIs speak it. When an app asks a server for data, the reply is almost always JSON. It maps cleanly onto the objects and arrays every language already has.
- It is human-readable. You can open a JSON response and understand it without tools, which makes debugging far easier than binary formats.
- It is tiny and universal. The spec is small, every language ships a JSON parser, and the format adds little overhead.
- Config files use it. From
package.jsonto countless tool settings, JSON is a common way to store configuration.
JSON vs XML
Before JSON, XML was the common data-exchange format. XML is more verbose — every value is wrapped in opening and closing tags — and supports features like attributes, namespaces and schemas that JSON does not. JSON won for web APIs because it is lighter, less noisy, and maps directly onto JavaScript objects in the browser. XML still has its place where its richer document features matter; for most data exchange, JSON is the default.
The honest limits
JSON's simplicity has trade-offs. It has no comments, so you cannot annotate a config file inline. It has no date type — dates are passed as strings by convention. It has no schema built in (though tools like JSON Schema add one separately), and large JSON documents are less efficient than purpose-built binary formats. For most web data, none of this matters; for very large or strongly-typed data, it is worth knowing.
FAQ
Is JSON only for JavaScript? No. The name comes from JavaScript syntax, but JSON is language-independent — Python, Go, Rust, Java and the rest all read and write it natively.
What is the difference between JSON and a JavaScript object? They look similar, but JSON is a text format (a string); a JavaScript object is a live in-memory value. You parse JSON text into an object, and stringify an object back into JSON.
Can JSON store comments? No. The format deliberately omits comments. Some tools accept "JSON with comments" variants, but standard JSON does not.
How are dates handled in JSON? As strings, by convention — usually ISO 8601 like "2026-06-14". JSON itself has no dedicated date type.
JSON is the data half of most web communication; the request-and-response machinery around it is the API. Browse more clear explainers in our guides index.
Frequently asked questions
What is JSON in simple terms?
JSON (JavaScript Object Notation) is a lightweight, human-readable text format for structured data. It represents data as key/value pairs and ordered lists, using a handful of types: objects, arrays, strings, numbers, booleans and null. It is the format most web APIs and configuration files use to exchange data, because it is simple for both people and machines to read and write.
What is the difference between JSON and XML?
Both store structured data as text, but JSON is lighter and less verbose: it has no closing tags and maps directly to the data types of most programming languages, which makes it easy to parse. XML is more verbose and supports things JSON does not, such as attributes, comments and schemas/namespaces. For most modern web APIs, JSON has become the default; XML still appears in older or document-centric systems.
Is JSON a programming language?
No. JSON is a data format, not a programming language — it only describes data, it cannot contain logic or run code. Its syntax was derived from JavaScript object literals, but JSON is language-independent and is read and written by virtually every programming language today.
What are JSON's main limitations?
JSON has no native date/time type (dates are usually strings), no comments, and no support for things like binary data without encoding. It also has no built-in schema in the format itself (though JSON Schema exists separately). For configuration where comments matter, formats like YAML or TOML are sometimes preferred; for data exchange, JSON remains the standard.