What Is JSON? A Practical Beginner's Guide with Examples

Learn what JSON is, how objects, arrays and values work, and see real examples. A beginner-friendly guide with a free formatter to try.

Advertisement

JSON (JavaScript Object Notation) is the most common way web services exchange structured data. APIs return it, config files use it, and front-ends consume it every day. It is text-based, lightweight, and readable by both humans and machines.

JSON in 30 seconds

A JSON document is built from six value types: objects, arrays, strings, numbers, booleans (true/false) and null. Here is a typical example:

{
  "name": "Ada Lovelace",
  "verified": true,
  "followers": 1240,
  "tags": ["programming", "history"],
  "address": { "city": "London", "country": "UK" }
}

Objects use curly braces with quoted keys. Arrays use square brackets. Strings must use double quotes — single quotes are not valid JSON.

Why is JSON so popular?

  • Simple: you can learn the whole syntax in an afternoon.
  • Universal: every major language parses it natively.
  • Compact: minified JSON is cheap to transfer over HTTP.
  • Toolable: formatters, validators and viewers make it easy to inspect.

Try it yourself

Paste the example above into our JSON formatter and press Format. Switch the indentation between 2 spaces, 4 spaces and tabs, then try Minify to see the compact form machines prefer. If you make a typo, the JSON validator shows the exact line and column.

JSON vs other formats

YAML is more human-friendly for configs, XML dominates legacy enterprise systems, and CSV wins for flat tables. JSON sits in the middle: structured enough for nesting, simple enough to read. Our converters (JSON to CSV, JSON to YAML, JSON to XML) help you move between them.

Common beginner mistakes

  • Trailing commas after the last item — not allowed in strict JSON.
  • Single-quoted strings — use double quotes.
  • Comments — standard JSON has none (see our JSON vs JSON5 guide).
  • Unquoted keys — {name: "Ada"} is invalid; write {"name": "Ada"}.

Next: learn how to format JSON step by step or how to fix validation errors.

Advertisement

Try it in the tools

Related guides

Advertisement