What JSON Is
JSON (JavaScript Object Notation) is a lightweight, text-based format for representing structured data, widely used for exchanging data between a server and a web application, storing configuration, and many other purposes. Despite its name referencing JavaScript, JSON is language-independent and used across virtually every modern programming language.
The Basic Building Blocks
JSON is built from just a few structures: objects (key-value pairs wrapped in curly braces {}), arrays (ordered lists of values wrapped in square brackets []), and a small set of value types — strings (in double quotes), numbers, booleans (true/false), null, and nested objects or arrays. Every piece of JSON data is some combination of these building blocks.
Strict Syntax Rules
Unlike more forgiving formats, JSON has strict rules: property names must be in double quotes (not single quotes), there must be no trailing comma after the last item in an object or array, and every opening brace/bracket must have a matching closing one in the correct place. A single missing comma, an extra comma, or using single quotes instead of double quotes is enough to make an entire JSON document invalid — most parsers won’t try to guess what you meant.
A Simple Example
A basic JSON object might look like:
{
"name": "Example",
"active": true,
"tags": ["one", "two"],
"details": { "count": 5 }
}Notice the double-quoted keys, no trailing commas, and properly nested braces/brackets.
Why Formatting (Not Just Validity) Matters
Technically, JSON doesn’t require any specific whitespace or indentation to be valid — a whole document can be on one line. But for a human reading or editing JSON, consistent indentation and line breaks (called ‘pretty-printing’) make the structure vastly easier to follow, especially in deeply nested data. A JSON formatter takes valid (or sometimes invalid) JSON and reformats it consistently, while also flagging syntax errors that would otherwise be hard to spot by eye — particularly useful when working with minified JSON from an API response or debugging a hand-written config file.