Guides

What Is JSON? A Beginner’s Guide to JSON Syntax

6 min read

JSON (JavaScript Object Notation) is the most widely used data format on the web. If you have ever called an API, edited a configuration file, or looked at a browser’s network tab, you have seen JSON. This guide explains what it is and how its syntax works, from the ground up.

What JSON is for

JSON is a text format for representing structured data. It was designed to be easy for humans to read and easy for machines to parse. Although it grew out of JavaScript, it is completely language-independent: virtually every programming language can read and write it.

Its main job is data interchange — moving structured information between systems. When a web app asks a server for your profile, the server typically replies with JSON. When a tool stores settings, it often saves them as JSON.

The building blocks

JSON is built from just a few value types, which can be nested inside one another:

  • Objects — an unordered set of key/value pairs wrapped in curly braces { }. Keys are always strings in double quotes.
  • Arrays — an ordered list of values wrapped in square brackets [ ].
  • Strings — text wrapped in double quotes, e.g. "hello".
  • Numbers — integers or decimals, written without quotes, e.g. 42 or 3.14.
  • Booleans — the literal values true or false.
  • null — represents the intentional absence of a value.

A worked example

Here is a small JSON document that uses every value type:

{
  "name": "Ada Lovelace",
  "age": 36,
  "active": true,
  "roles": ["admin", "author"],
  "address": {
    "city": "London",
    "postcode": null
  }
}

Reading it: the top-level value is an object with five keys. "roles" is an array of two strings, and "address" is a nested object. "postcode" is null, meaning no value is set.

Rules that trip people up

  • Keys and string values must use double quotes — single quotes are invalid.
  • No trailing commas: the last item in an object or array must not be followed by a comma.
  • Comments are not allowed in standard JSON.
  • The whole document must have exactly one top-level value (usually an object or array).

If you hit a parsing error, paste your JSON into the formatter above and it will point to the exact line and reason.

Frequently asked questions

What does JSON stand for?

JSON stands for JavaScript Object Notation. Despite the name, it is a language-independent format supported by nearly every programming language.

Is JSON a programming language?

No. JSON is a data format, not a language. It only describes data — it cannot contain logic or run code.

Can JSON have comments?

Standard JSON does not allow comments. Some tools support comment-friendly variants like JSONC, but plain JSON parsers will reject them.

Try the tools