What is JSON?

JSON (JavaScript Object Notation) is a lightweight, text-based data format used to exchange data between a server and a web application — or between any two software systems. Despite its name, JSON is completely language-independent and is supported natively by Python, PHP, Java, Ruby, Go, Rust, and virtually every other modern language.

JSON was derived from JavaScript object syntax but is not JavaScript itself. A JSON file is plain text, which means it can be read by humans and easily parsed by machines.

{ "name": "QuickMicroTools", "version": 2.0, "free": true, "tools": ["word-counter", "json-formatter"], "author": null }

Paste any JSON and format or validate it instantly — free, browser-based, no sign-up.

Open JSON Formatter →

JSON Data Types

JSON supports exactly six data types. Every value in a JSON document must be one of these:

String
"Hello World"
Text wrapped in double quotes. Must be escaped for special chars.
Number
42  /  3.14
Integer or float. No quotes. No hex or octal notation.
Boolean
true  /  false
Lowercase only. No quotes. No True or False.
Null
null
Represents an empty or missing value. Lowercase only.
Object
{ "key": "val" }
Unordered key-value pairs wrapped in curly braces.
Array
[1, "two", true]
Ordered list of values wrapped in square brackets.

JSON Syntax Rules

JSON has strict syntax rules. Unlike JavaScript, there is no flexibility — even a single violation makes the entire document invalid.

Pretty Print vs Minified JSON

The same JSON data can be written in two formats — both are syntactically identical and contain exactly the same information.

✓ Pretty printed (readable)
{ "id": 1, "name": "Alice", "active": true }
→ Minified (production)
{"id":1,"name":"Alice","active":true}

Use pretty printed JSON when reading, debugging, or working in development. Use minified JSON in production API responses and config files to reduce payload size and improve performance.

💡 Tip

Our JSON Formatter can both beautify (pretty print) and minify JSON — paste your data and choose the output format with one click.

6 Most Common JSON Errors

These are the errors that cause the most JSON parsing failures. Our formatter identifies and highlights all of them instantly.

🔴 1. Trailing Comma

A comma after the last item in an object or array is invalid in JSON (unlike JavaScript).

{ "name": "Alice", "age": 30, } ← invalid { "name": "Alice", "age": 30 } ← valid
🔴 2. Single Quotes

All strings and keys must use double quotes. Single quotes are not valid JSON.

{ 'name': 'Alice' } ← invalid { "name": "Alice" } ← valid
🔴 3. Unquoted Keys

Unlike JavaScript objects, JSON keys must always be wrapped in double quotes.

{ name: "Alice" } ← invalid { "name": "Alice" } ← valid
🔴 4. Comments

JSON does not support comments of any kind. Remove them before parsing.

{ "name": "Alice" // user name } ← invalid { "name": "Alice" } ← valid
🔴 5. Wrong Boolean / Null Casing

true, false, and null must be all lowercase. Title case or uppercase is invalid.

{ "active": True, "data": NULL } ← invalid { "active": true, "data": null } ← valid
🔴 6. Unescaped Special Characters

Special characters inside strings must be escaped with a backslash.

{ "path": "C:\Users\name" } ← invalid { "path": "C:\\Users\\name" } ← valid

Paste your JSON to instantly identify and highlight any of these errors — free validator included.

Open JSON Formatter →

How to Format JSON Online

Formatting JSON manually is tedious and error-prone. Our free JSON Formatter handles it in seconds:

  1. Open the JSON Formatter Tool.
  2. Paste your raw or minified JSON into the input box.
  3. Click Format to pretty print with 2-space indentation.
  4. If your JSON contains errors, the validator highlights the problem line.
  5. Use Minify to compress the output for production use.
  6. Copy the formatted result with one click.
✓ Privacy

All formatting and validation happens locally in your browser. Your JSON data is never sent to any server — safe for API responses, config files, and sensitive data.

JSON vs XML

JSON and XML are both formats for structuring and exchanging data. JSON has largely replaced XML for web APIs, but XML is still used in some industries. Here's how they compare:

JSON
{ "user": { "id": 1, "name": "Alice" } }
XML
<user> <id>1</id> <name>Alice</name> </user>

JSON Best Practices

Frequently Asked Questions

JSON (JavaScript Object Notation) is a lightweight text-based data format used to exchange data between systems. It is human-readable, language-independent, and natively supported by virtually every modern programming language.
The most common causes are: trailing commas after the last item, single quotes instead of double quotes, unquoted keys, comments (not supported in JSON), wrong casing for true/false/null, and unescaped backslashes in strings. Paste your JSON into our formatter to identify the exact error.
Pretty printed JSON has indentation and line breaks to make it human-readable. Minified JSON removes all whitespace to reduce file size. Both contain identical data — they only differ in formatting. Use pretty print for development; use minified for production.
No. The JSON specification does not support comments of any kind. If you need to document your JSON structure, use a README file or a schema tool like JSON Schema. Some tools (like VS Code) support JSONC — JSON with comments — but this is not standard JSON and will fail standard parsers.
JSON is a text format derived from JavaScript object syntax but is stricter. JavaScript objects allow unquoted keys, single quotes, trailing commas, comments, and functions. JSON allows none of these. JSON must be parsed (JSON.parse) before it can be used as a JavaScript object.

Conclusion

JSON is the backbone of modern web APIs, configuration files, and data exchange. Understanding its strict syntax rules — especially around quotes, commas, and data types — saves hours of debugging. A formatter that both pretty prints and validates in one step is an essential tool for any developer working with APIs.

Our free JSON Formatter runs entirely in your browser, handles any valid JSON regardless of size, and never transmits your data to any server.

Format, validate, and minify your JSON instantly — free, browser-only, no sign-up.

Open JSON Formatter →

Related Tools