Guide

What is JSON and how to format it correctly

·6 min read
What is JSON and how to format it correctly

JSON (JavaScript Object Notation) is the most common data interchange format on the web. It is lightweight, human-readable, and supported in virtually every programming language.

JSON is built on two structures: key/value pairs (objects) and ordered lists (arrays). Strings must be in double quotes, keys must always be strings, and trailing commas are not allowed.

A JSON formatter pretty-prints messy JSON to make it readable, validates its structure, and tells you exactly where the syntax breaks. Use ours at /tools/json-formatter — it works entirely in your browser, so nothing leaves your machine.

Common mistakes: • Using single quotes — JSON requires double quotes. • Trailing commas after the last item. • Unquoted keys — every key must be a string. • Comments — the JSON spec does not allow them. For configs that need comments, use JSON5 or YAML.

A quick tip: when working with APIs, always run the response through a formatter before reading it. You will spot errors much faster.

Share this article