Home › Guides

What Is JSON? Common Errors and How to Fix Them

The rules of the JSON format, typical syntax mistakes and how to make JSON readable.

JSON (JavaScript Object Notation) is a lightweight text format for moving data around. Web services, mobile apps and configuration files commonly use it. It is readable by people and easy for machines to parse.

Basic structure

JSON has two building blocks: objects, which are key–value pairs in curly braces, and arrays, which are lists of values in square brackets. Values can be strings, numbers, true/false, null, or other objects and arrays.

The most common mistakes

  • Using single quotes: JSON strings and keys need double quotes.
  • A trailing comma after the last item: [1, 2, ] is invalid.
  • Adding comments: JSON does not allow them.
  • Unquoted keys: {name: "Ann"} must be {"name": "Ann"}.
  • Missing or extra brackets.

Formatting and minifying

JSON from a server is often a single line that is hard to read. Beautifying indents each level so the structure becomes visible. Minifying removes all whitespace to cut the size when sending data over a network.

Finding the error

Paste your text into our formatter and, if it is invalid, you get a message pointing at the position of the problem. Usually the culprit is a missing comma or an extra quote just before that position.

Your data is processed in your browser and never sent anywhere, so it is safe to use with private data.

Open the tool: JSON Formatter →

More guides

All guides →

Missing a tool?