Development

What Is JSON? A Beginner's Guide for Developers

January 24, 2026 7 min read

If you've done any web development, you've met JSON. It's the format your browser uses to talk to servers, the shape of most API responses, and the contents of countless configuration files. But what actually is it? This guide explains JSON from the ground up.

JSON in one sentence

JSON (JavaScript Object Notation) is a lightweight, text-based way to store and exchange structured data. It was designed to be easy for both humans to read and machines to parse, which is exactly why it took over from heavier formats like XML for most web work.

The building blocks

JSON is built from just a few simple pieces:

  • Objects — collections of key/value pairs wrapped in curly braces: { "name": "Ada" }
  • Arrays — ordered lists wrapped in square brackets: [1, 2, 3]
  • Values — strings, numbers, true, false, null, or nested objects and arrays.

That's genuinely the whole format. Its power comes from nesting these pieces to describe almost any data structure.

A real example

Here's what a small user record might look like:

{
  "id": 42,
  "name": "Ada Lovelace",
  "active": true,
  "roles": ["admin", "editor"],
  "profile": {
    "city": "London",
    "joined": "2026-01-01"
  }
}

Notice how an object contains an array (roles) and another object (profile). This nesting is how JSON represents complex, real-world data.

The rules that trip people up

JSON is strict, and small mistakes cause "unexpected token" errors. The most common culprits:

  • Keys must be in double quotes. { name: "Ada" } is invalid; { "name": "Ada" } is correct.
  • No trailing commas. A comma after the last item breaks the whole document.
  • Only double quotes. Single quotes aren't allowed for strings.
  • No comments. Standard JSON has no way to add comments.

When a payload won't parse, these four are almost always the reason. A JSON formatter and validator pinpoints the exact line where things go wrong.

JSON vs. XML

Before JSON, XML was the standard for data exchange. XML is more verbose, using opening and closing tags for every element. JSON says the same thing with far less text, which means smaller payloads and faster parsing — a big deal for websites and mobile apps sending data over the network. XML still has its place (document markup, certain enterprise systems), but for APIs, JSON won decisively.

Where you'll use it

  • APIs: nearly every REST API returns JSON.
  • Config files: package.json, tsconfig.json and countless others.
  • Databases: document stores like MongoDB use a JSON-like format natively.
  • Local storage: browsers save structured data as JSON strings.

Keeping your JSON clean

Minified JSON (all on one line) is efficient for machines but painful for humans. When you're debugging, beautifying the JSON — adding indentation and line breaks — makes the structure obvious. When you're shipping data over the network, minifying it saves bytes. Our free JSON formatter does both, and flags any syntax errors along the way, so you can move between the two whenever you need to.