JSON explained: how to read, fix and convert it

Updated 31 October 2026

JSON (JavaScript Object Notation) is the format most websites and apps use to send data: weather apps, payment gateways, social networks and many government APIs exchange JSON behind the scenes. Configuration files, data exports and app settings often use it too.

It is meant to be readable by people as well as machines, but a single missing comma or quote makes the whole file invalid. This guide explains the structure, the rules that trip people up, and the everyday jobs of formatting, comparing and converting JSON.

The building blocks

JSON has only six kinds of value, which can be nested inside each other:

  • Objects: key–value pairs inside curly braces, such as {"name": "Asha", "city": "Pune"}. Keys are always text in double quotes.
  • Arrays: ordered lists inside square brackets, such as ["pdf", "image", "qr"].
  • Strings: text inside double quotes.
  • Numbers: written without quotes, such as 42 or 3.14.
  • Booleans: true or false, without quotes.
  • null: an empty value.

The rules that cause most errors

  • Double quotes only. Single quotes, which JavaScript allows, are invalid in JSON.
  • No trailing commas. [1, 2, 3,] is invalid because of the comma after the last item.
  • No comments. JSON has no // or /* */ comments; tools that accept them are using a relaxed variant such as JSONC.
  • Keys must be quoted. {name: "Asha"} is invalid.
  • Special characters inside strings must be escaped: \" for a double quote, \\ for a backslash and \n for a new line.

The JSON Formatter points to the line and column of the first error, and its “Fix common mistakes” option repairs trailing commas, single quotes, unquoted keys and comments automatically.

Everyday jobs

  • Reading an API response: paste it into the JSON Formatter and switch to the tree view to fold and unfold nested objects instead of scrolling through one long line.
  • Making it readable or compact: format it with indentation for reading, or minify it to remove the spaces before sending it.
  • Finding what changed: JSON Diff lists every added, removed and changed value with its path, ignoring key order and formatting.
  • Checking the structure: a JSON Schema describes which keys must exist and what type each value has. The JSON Schema Validator checks data against one and lists every problem with its path.

Converting JSON to other formats

  • JSON to CSV turns a list of objects into rows and columns you can open in Excel or Google Sheets. Nested objects become columns such as address.city.
  • CSV to JSON does the reverse, useful for importing a spreadsheet into an app or an API.
  • JSON to YAML writes the same data in an indented style that is easier to edit by hand, used in Kubernetes, Docker Compose and GitHub Actions files.

Converting JSON to YAML loses nothing. Converting to CSV works cleanly only for a list of similar objects, because a spreadsheet cannot hold deeply nested data.

The JSON, CSV, YAML, XML & TOML Converter does all of these in both directions, and handles XML and TOML too.

Questions people ask

Is JSON the same as a JavaScript object?

No. JSON borrowed its syntax from JavaScript but is stricter: keys must be in double quotes, and functions, comments, undefined and trailing commas are not allowed.

How big a JSON file can these tools open?

Files of several megabytes work smoothly because everything runs in your browser. Very large files are limited only by your device’s memory.

Tools used in this guide

All guides →