Gearboxly
DeveloperExplainerData

What Is JSON? A Beginner's Guide (with Examples)

By Gearboxly6 min read

If you've touched an API, a config file, or modern web development, you've met JSON. It's the format the web uses to move structured data around — and once you can read it, a huge amount of technical plumbing becomes legible.

Here's what JSON is, how its syntax works, and the small rules that trip everyone up at first.

What JSON is

JSON — JavaScript Object Notation — is a lightweight, text-based way to represent structured data. It's easy for humans to read and easy for machines to parse, which is why it became the default language for APIs, config files and data exchange across almost every programming language.

Despite the name, JSON isn't tied to JavaScript — Python, PHP, Java, Go and everything else read and write it happily.

The syntax in one example

JSON is built from key–value pairs inside objects `{ }`, plus arrays `[ ]` for lists. Here's a small example:

`{ "name": "Ada", "age": 36, "admin": true, "roles": ["editor", "owner"] }`

  • Objects `{ }` hold key–value pairs.
  • Keys are always strings in double quotes.
  • Values can be a string, number, boolean (`true`/`false`), `null`, an array, or another object.
  • Arrays `[ ]` hold ordered lists of values.

The rules that trip people up

  • Double quotes only — keys and strings must use `"`, never single quotes.
  • No trailing commas — a comma after the last item is invalid JSON (unlike JavaScript).
  • No comments — JSON has no comment syntax.
  • Keys must be quoted — `{ name: "Ada" }` is invalid; it must be `{ "name": "Ada" }`.

A single misplaced comma or quote breaks the whole document — which is why a formatter that flags the error is so useful.

Format and validate JSON

Raw JSON from an API often arrives as one unreadable line. The free JSON Formatter pretty-prints it with indentation and highlights syntax errors so you can spot that stray comma instantly.

JSON FormatterFormat, validate and minify JSON instantly.

Convert and compare JSON

Debugging an API? Format the response first — a pretty-printed structure makes it obvious where the data you want lives.

Tools mentioned in this post

Frequently asked questions

Moving structured data around — API responses, config files, and data exchange between programs. It's the web's default data format.

No. Despite the name, every major language reads and writes JSON. It's language-independent.

Usually a trailing comma, a single quote instead of a double quote, an unquoted key, or a comment. A formatter will point to the exact spot.

An object { } holds named key–value pairs; an array [ ] holds an ordered list of values.

Paste it into a JSON formatter to pretty-print it with indentation and catch any syntax errors.

Keep reading