JSON, defined simply
JSON stands for JavaScript Object Notation. It was derived from JavaScript's object literal syntax, but despite the name, it isn't tied to JavaScript — every major programming language can read and write it. JSON represents data as a combination of just a few building blocks: objects (key-value pairs in curly braces), arrays (ordered lists in square brackets), strings, numbers, booleans (true/false), and null. That's the entire vocabulary, which is exactly why it's so easy to parse and so widely supported.
A basic JSON example
{
"name": "Ada Lovelace",
"born": 1815,
"isProgrammer": true,
"languages": ["Analytical Engine notes"],
"spouse": null
}
Each key is a quoted string, each value is one of JSON's basic types, and objects/arrays can nest inside each other to represent arbitrarily complex data — a list of objects, an object containing arrays, and so on.
JSON vs. XML
Before JSON became dominant, XML was the standard for structured data exchange. XML uses opening and closing tags (<name>Ada</name>), which is more verbose than JSON's "name": "Ada". JSON is also a closer match to how most programming languages already represent data in memory (objects and arrays), so it typically requires less code to parse and generate. XML still has advantages for documents with mixed content and attributes, but for API responses and configuration data, JSON has become the default choice.
Where JSON is used
JSON is the standard response format for the overwhelming majority of web APIs — when a browser or app fetches data from a server, it's almost always getting JSON back. It's also used for application and package configuration files (many JavaScript, Python, and other project files are JSON), for NoSQL databases like MongoDB that store documents natively in JSON-like form, and for simple local data storage in browsers and apps.
JSON syntax rules worth knowing
A few rules trip people up because they're valid in JavaScript but not in strict JSON: object keys must be double-quoted strings (not single-quoted, not unquoted), and a comma can never follow the last item in an object or array. These are exactly the errors a JSON validator will catch instantly, with the line and column of the problem.