Guide

What Is JSON? A Beginner's Guide to the Web's Favorite Data Format

If you've ever seen a wall of text full of curly braces and quotation marks, you've met JSON. It's the format almost every app and website uses to store and send data — and it's simpler than it looks.

What JSON looks like

JSON stands for JavaScript Object Notation. A piece of JSON is just data described as pairs of names and values: {"name": "Ada", "age": 36}. The name is always in quotes, followed by a colon, followed by the value.

Values can be nested. A value can itself be another object (more name-value pairs in braces) or a list (values in square brackets), which lets JSON describe almost anything: a user, a shopping cart, an entire product catalog.

The six data types

JSON supports exactly six kinds of values:

  • String — text in double quotes: "hello"
  • Number — integers or decimals: 42, 3.14
  • Boolean — true or false (no quotes)
  • null — an empty value
  • Object — name-value pairs in curly braces: { ... }
  • Array — an ordered list in square brackets: [ ... ]

The syntax errors everyone makes

JSON is strict, and a single wrong character breaks the whole document. The most common mistakes: using single quotes instead of double quotes, leaving a trailing comma after the last item (allowed in JavaScript, illegal in JSON), forgetting quotes around a name, and adding comments (JSON has no comment syntax).

When JSON won't parse, the error message usually names a position — paste it into the formatter and it will pinpoint the problem.

Why formatting matters

Computers don't care about whitespace, so APIs often send JSON crammed onto one line to save bytes. That's unreadable for humans. "Pretty-printing" — indenting each level — turns an impenetrable wall of text into a structure you can scan at a glance.

Formatting changes nothing about the data itself; the same information is there either way. It's purely for your eyes.

Where you'll meet JSON

API responses, configuration files (package.json, tsconfig.json), browser local storage, and data exports are almost always JSON. Learning to read it fluently is one of the highest-value skills for anyone who works near software.

Try it yourself

Put this guide into practice with our free JSON Formatter — no sign-up, no download.

Open the JSON Formatter