What Is JSON? A Beginner's Guide
3 min readUpdated June 7, 2026
JSON, short for JavaScript Object Notation, is a lightweight text format for storing and exchanging structured data. Despite the name, it is not tied to JavaScript — it is just plain text that follows a small, strict set of rules, which means almost every programming language can read and write it. Its job is to represent data like objects, lists, numbers, and text in a way that is easy for both humans and machines to read.
You run into JSON constantly, often without noticing. When a website talks to a server, when an app saves its settings, or when two systems trade data over the internet, that information is usually packaged as JSON. This guide explains how JSON is structured, what kinds of values it can hold, where it shows up, and the small mistakes that quietly break it.
JSON syntax and structure
JSON is built from two basic structures. An object is a collection of key/value pairs wrapped in curly braces, like {"name": "Ada", "age": 36}. Each key is a string in double quotes, followed by a colon and its value, and pairs are separated by commas. An array is an ordered list of values wrapped in square brackets, like [1, 2, 3] or ["red", "green", "blue"].
These structures can nest inside one another to any depth, which is what makes JSON flexible. An object can contain arrays, an array can contain objects, and those can contain more objects and arrays. That nesting lets a single JSON document describe everything from a simple setting to a deeply structured record with lists, sub-objects, and more.
The data types JSON supports
JSON deliberately supports only six value types, which keeps it simple and predictable. There are strings (text in double quotes, like "hello"), numbers (such as 42 or 3.14, with no quotes), booleans (the literal words true and false), and null (which represents an empty or missing value). The remaining two types are the structural ones: objects and arrays.
Notice what is missing: there is no date type, no comments, and no way to store raw binary data or functions. Dates are usually written as strings (for example, an ISO timestamp like "2026-06-07"), and the application reading the JSON is responsible for interpreting them. This small, fixed set of types is a feature, not a limitation — it is why JSON behaves consistently across so many different languages and tools.
Where JSON is used
JSON is the default language of web APIs. When an app requests data from a server, the response almost always comes back as JSON, and when the app sends data, it usually sends JSON too. It is also extremely common in configuration files — many tools and projects store their settings in files like package.json or tsconfig.json. Beyond that, JSON is used for logging, for storing documents in databases, and for moving data between completely different systems.
Its popularity comes from being both human-readable and machine-friendly. A developer can open a JSON file and understand it at a glance, while a program can parse it in a single line of code. Because it is plain text, JSON also travels easily over networks and stores cleanly in files, which is why it has become the go-to format for data exchange.
Common mistakes that make JSON invalid
JSON looks forgiving but is actually strict, and a few small errors are responsible for most parsing failures. A trailing comma after the last item in an object or array — like [1, 2, 3,] — is invalid. Using single quotes instead of double quotes for strings or keys is not allowed; JSON requires double quotes everywhere. Forgetting to quote a key, as in {name: "Ada"} instead of {"name": "Ada"}, also breaks it.
Another frequent surprise is comments. JSON has no support for // or /* */ comments, so adding them will cause an error even though it feels natural to a programmer. When a file refuses to parse, these four issues — trailing commas, single quotes, unquoted keys, and comments — are the usual culprits. Running the text through a JSON formatter or validator quickly highlights exactly where the problem is.
Frequently asked questions
Is JSON a programming language?+
No. JSON is a data format, not a programming language. It only describes structured data — it has no logic, loops, or functions. Programming languages read and write JSON, but JSON itself does nothing on its own.
What is the difference between JSON and XML?+
Both store structured data, but JSON is lighter and easier to read, using objects and arrays. XML uses nested tags and is more verbose. JSON has largely replaced XML for web APIs because it is simpler to parse and produces smaller files.
Can JSON have comments?+
No. Standard JSON does not allow comments of any kind. Adding // or /* */ will make the file invalid. If you need comments, some tools support extensions like JSON5 or JSONC, but plain JSON does not.
What makes JSON invalid?+
The most common causes are trailing commas, single quotes instead of double quotes, unquoted keys, and comments. JSON is strict, so even one of these small mistakes will stop it from parsing. A formatter or validator pinpoints the exact location.