WebToolsDen
Your everyday tools,in one place

2026-03-12

What is JSON and How to Format It Properly

What is JSON?

JSON stands for JavaScript Object Notation. It is a lightweight text format for storing and exchanging structured data. Despite the name, JSON is not tied to JavaScript — it is used across every major programming language and is the most common format for API responses, configuration files, and data storage.

A simple JSON object looks like this: {"name": "Alice", "age": 30, "email": "alice@example.com", "active": true}

Data is stored as key-value pairs. Keys are always strings in double quotes. Values can be strings, numbers, booleans (true/false), arrays, objects, or null.

JSON data types

String: text in double quotes. Number: integer or decimal (42 or 3.14). Boolean: true or false. Array: an ordered list in square brackets. Object: key-value pairs in curly braces. Null: an empty value.

Why formatting matters

Raw JSON from an API often comes as a single line with no indentation — impossible to read at a glance. Formatted or pretty-printed JSON uses indentation and line breaks to show the structure clearly.

Unformatted: {"user":{"name":"Alice","age":30,"roles":["admin","editor"]}}

Formatted with proper indentation puts each key on its own line with nested objects indented. Both are identical data — the formatted version is just easier for humans to read.

How to format and validate JSON

Paste any JSON into the JSON Formatter tool. It automatically validates the syntax and displays the data with proper indentation. If there is a syntax error the formatter will highlight it immediately.

Common JSON errors

Missing or extra commas. JSON does not allow trailing commas after the last item in an object or array.

Single quotes instead of double quotes. JSON requires double quotes for all strings. Single quotes are not valid JSON.

Unquoted keys. Every key must be a string in double quotes.

Missing quotes around string values. String values must be in double quotes — bare words without quotes are not valid JSON.

FAQ

Is JSON the same as a JavaScript object? No. JSON is a text format that looks like a JavaScript object literal but has stricter rules — all keys must be quoted and only double quotes are allowed.

Can JSON contain comments? No. JSON does not support comments. If you need to annotate your data, use a field with a key like _comment.

What is the difference between JSON and YAML? Both are data formats but YAML is more human-readable, supports comments, and uses indentation instead of brackets. JSON is faster to parse and universally supported.

Try the tool

All Tools →