NV ToolkitFormat · Validate · Convert
Guide

What is JSON? A Practical Introduction

JSON (JavaScript Object Notation) is the data format of the modern web — the language APIs, config files, and services use to exchange structured data. This guide covers what JSON is, its complete syntax in five minutes, and the rules that trip people up.

In short

JSON (JavaScript Object Notation) is a lightweight, text-based data format built from six value types — strings, numbers, booleans, null, objects, and arrays — that represents structured data as nested key–value pairs and ordered lists. Defined by RFC 8259, it is language-independent, human-readable, and the default interchange format for REST APIs, config files, and databases.

By NaveenKumar T · Software engineer · builds and maintains NV Toolkit Published 2026-06-04 2 min read

JSON in one paragraph

JSON is a text format for representing structured data: objects of key–value pairs, ordered arrays, and a handful of value types. It was derived from JavaScript's object syntax (hence the name) but is language-independent — every mainstream language parses and produces it natively. Its entire grammar fits on a business card, which is precisely why it displaced heavier formats: there is almost nothing to learn and almost nothing to get wrong mechanically.

json
{
  "name": "Ada Lovelace",
  "born": 1815,
  "fields": ["mathematics", "computing"],
  "active": false,
  "advisor": null,
  "address": { "city": "London", "country": "UK" }
}

The six value types

Everything in JSON is one of six types. Strings: double-quoted, with backslash escapes (\n, \", \\, \uXXXX). Numbers: integer or decimal, optional exponent — no leading zeros, no NaN or Infinity. Booleans: true and false, lowercase. Null: the explicit absence of a value. Objects: unordered key–value pairs in braces, keys always double-quoted strings. Arrays: ordered values in brackets.

Composition is unrestricted — arrays of objects containing arrays of objects, as deep as your data demands. That recursive simplicity is the whole specification (RFC 8259).

The rules that break people

Almost every invalid JSON document violates one of five rules, all inherited from JSON being stricter than JavaScript. No trailing commas — [1, 2, 3,] is invalid. Double quotes only — 'single' quotes fail, on keys and values alike. Keys must be quoted — {name: "Ada"} is a JavaScript object literal, not JSON. No comments — neither // nor /* */ exist in the grammar. No undefined, NaN, or Infinity — use null, or strings, or restructure.

If you hand-edit JSON, a validator with exact error positions turns these from twenty-minute hunts into five-second fixes — which is exactly what our JSON Validator does, including a one-click repair for all five mistakes above.

Where JSON is used

REST and GraphQL APIs speak JSON almost exclusively. Configuration lives in it (package.json, tsconfig.json, composer.json). Databases store it natively — PostgreSQL's jsonb, MongoDB's documents. Logs ship as JSON lines for machine parsing. Browsers expose JSON.parse and JSON.stringify as built-ins, and every HTTP client defaults to it. Learning to read JSON fluently is learning to read the modern web's wire format.

JSON vs. the alternatives, briefly

Against XML: JSON is lighter (no closing tags), maps directly to data structures, but lacks attributes, namespaces and schema maturity — XML still owns document-centric and enterprise domains. Against YAML: YAML is more human-friendly for hand-written config (comments! no quote ceremony) but its whitespace sensitivity makes it error-prone; JSON wins for machine interchange. The formats interconvert losslessly in most practical cases — our JSON to YAML converter does it in one click.

How this was tested: Syntax examples were validated with the site's own parser (JSON.parse) on 2026-09-10.

Sources

  1. RFC 8259 — The JSON Data Interchange Format
  2. ECMA-404: The JSON Data Interchange Syntax
  3. MDN — JSON

Frequently asked questions

What does JSON stand for, and who created it?

JavaScript Object Notation. Douglas Crockford specified it in the early 2000s by extracting the data-literal subset of JavaScript; it was later standardized as RFC 8259 and ECMA-404. Despite the name, it has no runtime dependence on JavaScript.

Is JSON a programming language?

No — it's a data format. JSON has no variables, logic, or functions; it only describes values. That limitation is its strength: a JSON document can't do anything, which makes it safe to exchange between systems.

What is a .json file and how do I open it?

A plain-text file containing one JSON document, served with the application/json MIME type. Any text editor opens it; for structure-aware reading (folding, tree navigation, validation), use a dedicated viewer like our JSON Viewer.

Paste any JSON into our free JSON Formatter — format, validate and explore it in a VS Code-style editor.

Try it now

Keep working

Related tools

JSON Formatter

Format, beautify, and validate JSON instantly in a professional VS Code-style editor — free, fast, and 100% private.

JSON Validator

Strict RFC 8259 validation with the exact line and column of every error — plus one-click repair for broken JSON.

JSON Editor

A full VS Code-style editing experience for JSON — highlighting, error squiggles, undo/redo, search, and formatting in one place.

JSON Pretty Print

Turn dense single-line JSON into beautifully indented, readable output — your choice of indentation, with optional alphabetical key sorting.

JSON Viewer

Explore any JSON document in an interactive, collapsible tree — keys, types, and counts at a glance, with code view one click away.

JSON Parser

Run a real JSON parse in your browser — see exactly what your application will see, or exactly where it will fail.

JSON Minifier

Compress JSON to its smallest valid form by stripping every unnecessary character — with full validation built in.

JSON Stringify Online

The exact behavior of JavaScript's JSON.stringify() — compact by default, the space argument, and what the serializer silently drops — plus a mode that reverses it.

JSON to One Line

Strip every line break and indent from your JSON to get a clean single-line version — perfect for logs, env vars, and curl.

JSON Sorter

Recursively sort every object's keys A→Z — arrays keep their order — for stable diffs, clean reviews, and canonical configs.

JSON Compare

Side-by-side JSON diffing with VS Code's engine — highlighted changes, editable panes, and key-order-insensitive comparison.

JSON Builder

Build a JSON document field by field. Dot-notation paths create the nested objects and arrays for you, and the result is always valid — no stray commas, no unbalanced braces.

JSON Repair

Paste JSON that almost parses — single quotes, trailing commas, comments, a truncated tail — and get valid, formatted JSON back.

JSON Size Calculator

Measure exactly what a JSON payload costs — raw, minified, pretty-printed and gzipped bytes — and see which keys are eating the budget.

JSON to YAML

Re-express JSON as clean, human-friendly YAML — smart quoting, two-space indentation, list dashes done right.