HandyTools Hub

← All guides

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

2026-09-03

Every time an app loads, a form submits, or a page updates with a chat message, some JSON is almost certainly moving behind the scenes. It is the default data format of the web, and once you can read it, a lot of the mystery around APIs and configuration files disappears.

This guide explains what JSON is, the small set of rules that define it, and how to use a formatter to validate, pretty-print, and minify it like a pro.

What JSON is

JSON stands for JavaScript Object Notation. It is a text format for data, standardized in the early 2000s and now used across virtually every language and platform.

The key insight is that JSON is just text: a string you can copy, paste into a file, email, or send over a network. It carries no program logic — only data. That is what makes it so portable. A JSON document produced by a PHP server is read by a JavaScript front end and stored in a Python database, all without anyone translating anything.

The six JSON types

A JSON document is built from just six building blocks:

  1. Object{ "name": "Alice", "age": 30 } — an unordered set of key: value pairs in curly braces.
  2. Array["a", "b", "c"] — an ordered list of values in square brackets.
  3. String"hello" — text in double quotes.
  4. Number42, 3.14 — an integer or decimal, no quotes.
  5. Booleantrue or false.
  6. Nullnull — a value that represents “nothing.”

Objects and arrays are the containers; the other four are the leaves. Any value can live inside an object or an array, which is how you build nested structures like an API response that contains a list of users, each with their own address object.

Why JSON beat XML

Before JSON, the common structured-data format was XML. XML is powerful but verbose: every piece of data needs an opening and closing tag. A single value that in JSON looks like "age": 30 becomes several lines of <age>30</age>.

JSON replaced that with a far more compact syntax, and it has one other superpower: it maps almost one-to-one onto the objects and arrays that JavaScript uses natively. A JavaScript developer can read JSON and immediately see the data structure without any conversion. That combination of brevity and familiarity is why JSON became the default.

Formatting, validating, and minifying JSON

Because JSON can be written on a single long line, it is often messy to read. Three operations fix that:

  • Formatting (beautify) adds indentation and line breaks so the nesting is obvious. If a payload is seven levels deep, formatting alone can make it readable.
  • Validation checks that the text is well-formed. The most common error is a trailing comma, or a missing closing brace — errors that a browser will silently accept in some places but break your code in others.
  • Minifying strips all unnecessary whitespace, producing the smallest possible payload for production. This is what you want when shipping JSON over a network.

A good formatter gives you all three in one tool. It should tell you where an error is, so you don’t hunt through a wall of brackets.

Once your document is valid, the next questions are how it can still go wrong — cataloged in common JSON errors — and how to describe its shape with JSON Schema.

Common things that trip people up

JSON is strict in ways that JavaScript is not, and those strictness rules are the usual source of bugs:

  • Double quotes only. { name: "Alice" } is invalid; it must be { "name": "Alice" }. JavaScript allows single quotes and bare keys; JSON does not.
  • No trailing commas. [1, 2, 3,] is invalid in JSON.
  • Numbers have no quotes, strings always do. 30 is a number, "30" is a string.
  • No comments. You cannot put // or /* */ inside a JSON document.

If your JSON validation keeps failing, check for these four first.

Quick Reference

  • JSON is text-only data — a portable string with no program logic, readable across every language.
  • Six building blocks: object, array, string, number, boolean, null. Objects and arrays are the containers; the other four are the leaves.
  • JSON is strict where JavaScript is lax: double quotes only, no trailing commas, numbers unquoted, strings always quoted, no comments.
  • Formatting adds structure, validation catches malformed text, minifying produces the smallest production payload.
  • JSON beat XML because it is compact and maps almost one-to-one onto JavaScript objects and arrays.

Getting started

If you’re staring at a JSON blob from an API, the JSON Formatter is your quickest way to make sense of it: paste it in, validate it, format it, and copy a clean version. And if a payload appears as a garbled Base64 string, the Base64 Encoder/Decoder can decode it back to readable JSON first.