JSON Formatter: Beautify, Validate and Repair
Paste JSON and it is formatted as you type, with the line and column of any error. Minify, sort keys, repair common mistakes and copy any node's JSONPath. Nothing is uploaded.
Rate this toolJSON Studio
Beautify · minify · sort · repair · text and tree
Your JSON
Beautifies as you paste, or drop a .json file on the box. .
Actions
Repair fixes unquoted keys, single quotes, trailing commas and comments.
Indent
Output
Paste JSON in the box. It is formatted here as soon as you stop typing.
- One-tap actions
- 4One-tap actions
- Indent styles
- 3Indent styles
- Views: text and tree
- 2Views: text and tree
- Bytes uploaded
- 0Bytes uploaded
Do more with your JSON
Tools that pick up where this one leaves off.
Clean JSON in three steps
From a squashed API response to readable, checked JSON. No sign-up and no upload.
- STEP 01
Paste or upload
Paste JSON into the box, drop a .json file on it, or use Upload.
Formats as you paste - STEP 02
Pick an action
Beautify, minify, sort keys or repair. Errors show their line and column.
One tap each - STEP 03
Copy or download
Copy the result, save it as a .json file, or copy any node's JSONPath from the tree.
Text or tree view
How to use this JSON formatter
Parsing uses the browser's own JSON.parse, the same strict parser your JavaScript code uses.
- 1
Paste your JSON
It is beautified a moment after you stop typing. A Valid or Invalid pill shows the result.
- 2
Fix any error
Read the line and column in the error, or tap Repair for unquoted keys, single quotes, trailing commas and comments.
- 3
Shape the output
Choose 2 spaces, 4 spaces or tabs. Minify for one line, or sort keys to make two payloads easy to compare.
- 4
Explore and copy
Switch to the tree view to fold big objects and copy a node's JSONPath, then copy or download the result.
Habits for JSON that never breaks
Four rules that prevent most of the errors this tool finds.
Double quotes only
JSON strings and keys must use double quotes. Single quotes are a JavaScript habit, not JSON.
- "key": "value"
- Escape inner " as \"
- No backticks
No trailing commas
A comma after the last item is fine in JavaScript and an error in JSON.
- Comma between items
- None after the last
- Watch copy-paste edits
Unique keys
The standard says keys in one object should be unique. Most parsers keep only the last value.
- One key, one value
- Check merged configs
- This tool warns you
Let code write it
Hand-typed JSON breaks. JSON.stringify and similar functions always produce valid output.
- Serialise, don't type
- Validate config files
- Format before review
The JSON errors you will meet most
What each one means, and whether Repair can fix it.
Unexpected token }
Usually a trailing comma before a closing brace or bracket.
- Remove the last comma
- Or tap Repair
- Check the line shown
Unexpected token '
Single-quoted strings or keys, often from a JavaScript object pasted as JSON.
- Use double quotes
- Or tap Repair
- Apostrophes inside are kept
Unquoted property name
Keys like {name: 1} are valid JavaScript, not JSON.
- Quote every key
- Or tap Repair
- Comments are removed too
Unexpected end of input
The text stops early: a missing } or ], or a cut-off paste.
- Count the brackets
- Check the paste was complete
- Use the tree to find the gap
Who formats JSON every day
Most of the web moves data as JSON, so most technical jobs touch it.
Backend developers
Reading responses, checking request bodies and writing fixtures all start with readable JSON.
QA and testers
Checking a response has the right fields is faster in a tree than in one long line.
DevOps engineers
Hand-edited config files pick up trailing commas and comments that break deploys.
Data analysts
Exports from tools and databases often arrive minified and deeply nested.
What RFC 8259 says valid JSON is
The rules every strict JSON parser, including the one in your browser, follows.
The rules
What the JSON standard allows and requires.
- Strings and keys in double quotes
- No comments, no trailing commas
- Values: object, array, string, number, true, false, null
- Keys in one object should be unique
- Whitespace between tokens is allowed
What Repair fixes
Common non-JSON habits that Repair turns into valid JSON.
- {name: 1}: Unquoted keys get quotes
- 'text': Single quotes become double
- [1, 2,]: Trailing commas are removed
- // note: Comments are stripped
Not JSON
These are valid in JavaScript but rejected by a JSON parser.
- undefined as a value
- NaN or Infinity
- Functions as values
- Hex numbers like 0x1F
- Leading zeros like 007
Keeping JSON tidy in a project
A formatter fixes one file. These habits keep a codebase's JSON clean.
- 1
Pick one indent
Agree on 2 spaces, 4 spaces or tabs for the project, so diffs show real changes, not whitespace.
- 2
Sort before comparing
Two payloads with the same data in a different key order look different. Sort keys on both, then compare.
- 3
Validate in CI
Parse every committed .json file in your build, so a stray comma fails a check instead of a deploy.
- 4
Keep secrets out
Format sensitive payloads in a local tool like this one, and remove tokens before sharing a sample.
This formatter vs a code editor vs the command line
All three can format JSON. Pick by where you already are.
| Feature | CleverTools formatter | Code editor | jq on the command line |
|---|---|---|---|
| Setup | ✓ None | Install and open | Install jq |
| Error line and column | ✓ Yes | ✓ Usually | ✓ Yes |
| Repair common mistakes | ✓ One tap | ✗ By hand | ✗ No |
| Tree view with JSONPath copy | ✓ Yes | With extensions | ✗ No |
| Scripting and filtering | ✗ Not included | Limited | ✓ Its main job |
| Data leaves your device | ✓ Never | ✓ Never | ✓ Never |
Need types for this JSON? Generate interfaces with JSON to TypeScript.
Pro tips for working with JSON
Small habits that save time on every payload.
Fold big payloads
Use the tree view to collapse arrays you don't need and find the field you're after.
Copy the path, not the value
A JSONPath like $.data.items[0].id tells a teammate exactly where to look.
Sort to compare
Sort keys on both versions before you diff them, so only real changes stand out.
Minify for embedding
One-line JSON fits in an environment variable, a query string or a script tag.
Repair, then review
Repair guesses what you meant. Read the result before you use it in production.
Mind repeated keys
If a key appears twice, the parser keeps the last one and silently drops the first.
Strip tokens first
Remove passwords and API keys before you paste a payload into a ticket or a chat.
Same indent everywhere
Use the indent your project uses, so a formatted file doesn't create a noisy diff.
An object literal you can paste into JavaScript is often not valid JSON: single quotes, unquoted keys, comments and trailing commas all fail. Repair handles those four, and the error message points to anything else.
Beautify or minify? Which output to use
Both hold exactly the same data. The only difference is the whitespace between tokens, which JSON allows and parsers ignore.
Beautified
One key per line, indented by depth. Easy to read, review and diff. This is what the studio shows by default, with 2 spaces, 4 spaces or tabs.
Best for config files, code review and debugging
Minified
Every optional space and line break removed. Smaller to send and store, and fits where line breaks are not allowed. How much smaller depends on how deeply the original was indented.
Best for API payloads, env variables and embedding
Who uses this JSON formatter
Six everyday jobs that start with a wall of JSON.
Reading API responses
Turn a one-line response from DevTools into something you can read.
Fixing broken config
Find the stray comma in a settings file by its line and column.
Writing tests
Copy a JSONPath from the tree straight into an assertion.
Comparing payloads
Sort keys on two versions so a diff shows only real changes.
Checking exports
See the depth and counts of an export before you load it.
Learning JSON
Watch the tree view show how objects and arrays nest.
Need a spreadsheet instead? Convert with JSON to CSV, YAML or XML.
Frequently asked questions
Quick answers about formatting, repair and privacy.
What does Beautify vs Minify do?
What does the Repair button fix automatically?
What's the Tree view for?
What stats does the tool show?
Can I sort the keys alphabetically?
Is my data uploaded anywhere?
Can it handle large JSON files?
What indentation styles are supported?
What people say
Reviews from people who used this tool.
Loading reviews…
More free JSON and data tools
Free, with no sign-up, just like this one.
- Free toolCSV to JSON ConverterConvert between CSV and JSON in your browser - auto delimiter detection, type inference, and a typed preview table.Try it now
- Free toolData Converter - JSON / XML / CSV / YAMLConvert between JSON, XML, CSV, and YAML in any direction - RFC-4180 CSV, browser-only, no signup.Try it now
- Free toolJSON to TypeScriptConvert JSON to TypeScript interfaces, type aliases or a Zod schema - merges arrays, detects string enumsTry it now
- Free toolText Formatter & CleanerClean AI or copied text: strip markdown, fix line breaks and spacing, change case and add LinkedIn boldTry it now
- Free toolWhatsApp Bulk Message FormatterCompose formatted WhatsApp messages with placeholders and generate personalized bulk links from CSV contactsTry it now
- Free toolCSS Beautifier & FormatterBeautify, format, or minify CSS code instantly in your browser.Try it now