If you've spent any time around web development, APIs, or even just fiddling with app settings, you've probably run into JSON. It's the universal language of data exchange on the modern internet. Here's what it is and why it matters.

What Is JSON?

JSON stands for JavaScript Object Notation. It's a lightweight, text-based format for storing and exchanging structured data. The reason it took over the internet is simple: it's easy for humans to read and write, and easy for machines to parse and generate. Almost every modern API โ€” from Google to Twitter to Stripe โ€” speaks JSON.

A simple JSON example:

{
  "name": "Scy",
  "age": 30,
  "city": "New Westminster",
  "hobbies": ["coding", "gardening", "trading"]
}

JSON Structure: The Basics

JSON is built from just a handful of building blocks:

  • Objects โ€” wrapped in curly braces { }, containing key-value pairs
  • Arrays โ€” wrapped in square brackets [ ], containing ordered lists
  • Strings โ€” text in double quotes, like "hello"
  • Numbers โ€” integers or decimals, no quotes
  • Booleans โ€” true or false
  • Null โ€” null, representing "no value"

Why Is Valid JSON Important?

JSON looks forgiving, but it's actually strict. A single missing comma, an unclosed brace, or โ€” the classic mistake โ€” a trailing comma after the last item in a list will make the entire document invalid. When that happens, the API rejects your request or your code crashes with a cryptic error.

The most common JSON errors are:

  • Trailing commas โ€” a comma after the final element in an object or array
  • Single quotes instead of double quotes โ€” JSON requires double quotes
  • Unclosed braces or brackets โ€” a missing } or ]
  • Comments โ€” JSON doesn't support comments (this trips up a lot of people)
  • Unescaped characters โ€” special characters inside strings that break parsing

What Does a JSON Formatter Do?

When you paste minified JSON (where everything is crammed onto one line to save space), it's nearly impossible to read. A JSON formatter does two jobs:

  1. Pretty-prints โ€” adds indentation and line breaks so the structure is visible
  2. Validates โ€” tells you if the JSON is valid and, if not, exactly where the error is

This is invaluable when you're debugging an API response or hand-editing a config file.

Where You'll Encounter JSON

  • API responses โ€” when you fetch data from a web service
  • Config files โ€” app settings, package managers, build tools
  • Browser storage โ€” local storage and IndexedDB
  • Webhooks โ€” event data pushed from services like Stripe or GitHub
  • NoSQL databases โ€” like MongoDB, which stores documents as JSON

Have a blob of JSON you need to make readable? Format and validate JSON now โ†’