What Is a JSON Formatter?
A JSON formatter (also called a JSON beautifier or JSON pretty-printer) takes raw or minified JSON and reformats it with proper indentation and line breaks so it's easy to read. It can also validate your JSON and catch syntax errors before they cause problems in your code.
Why Use a JSON Formatter?
Debugging APIs — API responses often come as a single minified line. Formatting them makes it easy to inspect the data structure, find specific fields, and spot unexpected values.
Config Files — JSON is used for configuration files in Node.js (package.json), VS Code (settings.json), TypeScript (tsconfig.json), and many other tools. Keeping these files formatted makes them readable and maintainable.
Database Inspection — When querying databases that store JSON (MongoDB, PostgreSQL JSONB), the raw output is often hard to read. Formatting it helps you understand the data.
Sharing & Documentation — Formatted JSON is easier for teammates to read in pull requests, documentation, and Slack messages.
How to Use This Tool
- Paste your JSON into the input box.
- Choose your indent — 2 spaces, 4 spaces, or 1 tab.
- Click Format to beautify, or Minify to compress.
- Copy the result with one click.
If your JSON has syntax errors, the tool will show you the exact error message so you can fix it.
JSON Syntax Rules
Valid JSON must follow these rules:
- Strings must use double quotes (
"key", not'key') - Keys must be strings (no unquoted identifiers)
- No trailing commas —
{"a": 1,}is invalid - No comments — unlike JavaScript, JSON doesn't support
//or/* */comments - No undefined — use
nullinstead - Numbers can't have leading zeros (
01is invalid,0.1is fine)
Format vs. Minify
Formatting (beautifying) adds whitespace, indentation, and line breaks to make JSON readable. This is useful for debugging and inspection.
Minifying removes all unnecessary whitespace to make the JSON as compact as possible. This reduces file size for storage and network transfer.
Common JSON Errors
- Unexpected token — Usually means a missing or extra comma, bracket, or quote.
- Unexpected end of JSON — The JSON is incomplete, often a missing closing
}or]. - Expected double-quoted property name — You used single quotes or unquoted keys.