JSON: The Lingua Franca of Web APIs
JSON is a universal translator for data, using human-readable text to describe objects and lists. It's the default for web APIs sending data to browsers. The footgun is treating it as a JavaScript object; JSON is a stricter string format.
WHY IT EXISTS: The web needed a simple, text-based way for different systems, like a server written in Java and a browser running JavaScript, to exchange structured data. Before JSON, formats like XML were common but were more verbose and harder for both humans and machines to parse quickly. JSON was designed to be minimal, text-based, and a subset of JavaScript's object syntax, making it a natural fit for web applications.
THE MENTAL MODEL: Think of JSON as a set of shipping instructions for data. It's a standardized, plain-text manifest that describes the contents of a package (the data) using two simple structures: a list of items (an array) and a collection of labeled items (an object with key-value pairs). Any programming language can read this manifest and reconstruct the original data package in its own native format.
HOW IT WORKS: JSON represents data as name-value pairs (an object, like {"name": "Alice"}) or as an ordered list of values (an array, like ["apple", "banana"]). Values can be strings in double quotes, numbers, booleans, null, or even other objects and arrays. The entire payload is transmitted as a single text string, which a receiving system then parses back into its native data structures.
WHEN TO USE IT: Use JSON whenever you need to send structured data between systems, especially over the web. It's the standard for REST APIs that power most modern web and mobile applications. It's also excellent for configuration files (like package.json) because it's easy for both humans to read and programs to parse.
WHEN NOT TO USE IT: JSON is not ideal for high-performance computing where data size is critical. Binary formats like Protocol Buffers are more compact and faster to parse for internal microservice communication. JSON also lacks support for comments, making it less suitable for complex configuration files where inline documentation is crucial.
ONE CANONICAL EXAMPLE: A web server responding to a request for user data. The backend queries a database and serializes the user's info into a JSON string: {"user_id": 123, "username": "alex", "is_active": true, "roles": ["editor", "contributor"]}. The web browser's frontend receives this string, parses it, and can then easily access the data as a JavaScript object to display the user's profile.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.