JSON Formatter
Beautify, minify, validate and repair JSON online, free and private.
Paste messy or minified JSON and turn it into clean, readable data in one click. Choose 2 spaces, 4 spaces or tabs, sort keys A–Z and explore the result in a collapsible tree view. Need the opposite? Minify your JSON to make it smaller, or click Validate to find a missing comma, bracket or quote by line and column. Repair fixes common mistakes such as trailing commas, comments and single quotes. Your JSON is processed in your browser and never uploaded. The tool is free, with no sign-up.
No Sign-Up, No Install
Plus Validate & Repair
JSON Never Leaves Your Browser
2 Spaces, 4 Spaces or Tabs
Repair fixes comments, trailing commas, single quotes, unquoted keys, missing commas and Python or JavaScript values like None and undefined. Big numbers are kept exactly as written.
Tip: press Ctrl + Enter inside the input box to beautify. You can also drop a file onto the input.
Private by design: your code is formatted in your browser and never uploaded. Protected by Cloudflare Turnstile.
How Do You Format JSON Online?
To format JSON online, paste your data into the JSON input box or click Upload to open a .json, .geojson or .txt file, choose your indentation and options under Settings, then click Beautify JSON. The formatted JSON appears in the Result box as code or as a collapsible tree, ready to Copy or Download as formatted.json. Click Minify for a compact one-line version, or Validate to check your syntax and see the exact line and column of any error.
JSON (JavaScript Object Notation) is the most common format for APIs, config files and data exchange, but it is often hard to read: API responses arrive on a single line, webhook payloads are deeply nested, and hand-edited config files break because of one missing comma. A JSON formatter, also called a JSON beautifier, pretty printer or JSON viewer, adds consistent indentation and line breaks so you can read, debug and compare JSON quickly. A JSON minifier does the reverse, removing whitespace so payloads are smaller and faster to send.
Everything happens on your own device. Beautify, Minify, Validate and Repair all run on Teasoft’s own lightweight JSON parser inside your browser. Your JSON is not sent to Teasoft or anyone else, so you can safely format API responses, access tokens, customer records and other private data.
What changes in your JSON:
| Part of your JSON | When you beautify | When you minify |
|---|---|---|
| Indentation and line breaks | Rebuilt with 2 spaces, 4 spaces or a tab for each nesting level. | Removed, so the JSON fits on one line. |
| Keys and values | Kept exactly. Keys are sorted only if you tick Sort keys A–Z. | Kept, with the spaces around { } [ ] : and , removed. |
| Short arrays | Put on one line if you tick Short arrays on one line and they fit in 80 characters. | Always on one line. |
| Strings | Unchanged, including escape sequences and Unicode. | Unchanged. |
| Large numbers | Kept exactly as written, even beyond JavaScript’s safe integer limit. | Kept exactly as written. |
| Comments and trailing commas | Reported as errors, or removed when Repair common mistakes is ticked. | Reported as errors, or removed when Repair common mistakes is ticked. |
Common reasons to format JSON
- Reading a one-line API response from Postman, curl or browser DevTools.
- Debugging webhook payloads, log entries and error responses.
- Tidying config files such as package.json, tsconfig.json, composer.json or appsettings.json before a commit.
- Finding the missing comma, bracket or quote that makes JSON.parse fail.
- Minifying JSON before sending it in a request, storing it in a database or embedding it in code.
- Exploring large nested data in a tree view and copying the path to a value.
What each control does:
| Control | What it does | When to use it |
|---|---|---|
| JSON input box | Holds the JSON you want to format and shows its characters, lines and size | Paste, type or drop a file here. |
| Upload, Paste, Sample and Clear | Opens a .json, .geojson or .txt file, pastes from your clipboard, loads example JSON or empties the box | Click Sample to try the tool before using your own data. |
| Indentation | Sets 2 spaces, 4 spaces or a tab for each level | Match your project’s code style or .editorconfig. |
| End with a new line | Adds a final line break to the result | Keeps Git, linters and editors happy. |
| Sort keys A–Z | Sorts object keys alphabetically at every level | Compare two JSON files or keep config files tidy. |
| Repair common mistakes | Fixes comments, trailing commas, single quotes, unquoted keys, missing commas and values like None or undefined | Clean up JSON copied from JavaScript, Python or a hand-edited file. |
| Short arrays on one line | Keeps arrays of simple values on one line when they fit in 80 characters | Make coordinates, tags and number lists more compact. |
| Beautify JSON, Minify and Validate | Formats, compresses or checks your JSON | Press Ctrl + Enter inside the input box to beautify quickly. |
| Code and Tree views | Shows the result as text or as a collapsible tree with Expand and Collapse | Use Tree to explore nested data and copy the path of a key. |
| Copy, Download and Use as input | Copies the result, saves it as formatted.json or moves it back into the input | Use as input lets you repair, then minify, without copy and paste. |
Good to know
- Formatting doesn't change your data. Only whitespace changes, so keys, values and their order stay the same, unless you tick Sort keys A–Z.
- Validate follows strict JSON rules. It shows the first error by line and column, counts keys, objects, arrays and nesting depth, and warns about duplicate keys.
- Repair is optional. Leave it off to see exactly what is wrong, or turn it on to fix comments, trailing commas, single quotes, unquoted keys and Python or JavaScript values automatically.
- Big numbers stay exact. Long IDs and precise decimals are kept as written instead of being rounded, as JSON.parse would do.
- Your data stays private. Nothing is uploaded or saved on a server, and your original file on your device is never changed.
What You Can Do With This Tool
- Format JSON for free. No software to install and no account needed.
- Beautify minified JSON. Turn one-line API responses into readable, indented data.
- Choose your indentation. Use 2 spaces, 4 spaces or tabs.
- Sort keys A–Z. Order object keys alphabetically at every level.
- Minify JSON. Remove whitespace and line breaks to make payloads smaller.
- Validate JSON syntax. Find errors by line and column and spot duplicate keys.
- Repair broken JSON. Fix trailing commas, comments, single quotes, unquoted keys and missing commas.
- Explore a tree view. Expand, collapse and copy the path of any key.
- Keep big numbers exact. Long IDs and precise decimals are never rounded.
- Upload or drop files. Open .json, .geojson and .txt files up to 10 MB.
- Copy or download. Copy the result or save it as formatted.json.
- Use any device. Works on Windows, Mac, Linux, Android and iPhone.
Which Formatter Should I Use?
Use the JSON Formatter for API responses, data files and config files. For the rest of your code, Teasoft has a free formatter for each language:
How to Format JSON (3 Steps)
Add your JSON
Paste your data into the JSON input box, drop a .json file onto it or click Upload. Click Sample to try an example first. Files can be up to 10 MB.
Choose your settings
Pick 2 spaces, 4 spaces or Tab, then choose options such as Sort keys A–Z or Short arrays on one line. Tick Repair common mistakes if your JSON came from JavaScript, Python or a hand-edited file.
Beautify, then copy or download
Click Beautify JSON or press Ctrl + Enter. Your clean JSON appears in the Result box. Switch to Tree to explore it, then click Copy, or Download to save it as formatted.json.
Tip: keep a readable, formatted copy of your JSON for editing and reviewing, and use a minified copy in API requests or storage. To get one, click Use as input after beautifying, then Minify. If you also work with YAML config files, use the YAML Formatter.
Which Option Should I Use?
| Task | Use | Why |
|---|---|---|
| Read a one-line API response | Beautify JSON | Adds indentation and line breaks so every key and value is easy to find. |
| Explore deeply nested data | Tree view | Expand only the parts you need and copy the path to any key. |
| Make JSON smaller for a request or database | Minify | Removes all unnecessary whitespace to cut payload size. |
| Find why JSON.parse fails | Validate | Points to the first error by line and column, such as a missing comma or quote. |
| Fix JSON copied from JavaScript or Python | Repair common mistakes | Removes comments and trailing commas, quotes keys and converts single quotes, None and undefined. |
| Compare two JSON files | Sort keys A–Z | Puts keys in the same order so a diff shows only real changes. |
| Check required fields and data types | A JSON Schema validator | Validate checks syntax only, not whether the data matches a schema. |
Getting better results when you format JSON
- Validate first. If Beautify shows an error, run Validate to see the exact line and column before you change anything.
- Check what Repair changed. Repair lists every fix it made, so review the result before you use it.
- Match your project's indentation. Use the same setting as your editor or Prettier so Git diffs stay small.
- Sort keys only when order doesn't matter. Most programs ignore key order, but some configs and signed payloads depend on it.
- Watch for duplicate keys. If Validate warns about one, most parsers keep only the last value.
After you format your JSON
- Check the result. Test the formatted or repaired JSON in your app before you replace the original.
- Minify for production. Click Use as input, then Minify to get a compact copy for API requests or storage.
- Format your config files. Tidy related YAML files with the YAML Formatter.
- Format your scripts. Clean up the code that reads your JSON with the JavaScript Formatter.
Frequently Asked Questions
How do I format JSON online?
Paste your JSON into the input box, choose your indentation, then click Beautify JSON. Copy the result or download it as formatted.json.
Is Teasoft's JSON Formatter free?
Yes. It is completely free, with no sign-up and no limit on how often you use it.
Is my JSON uploaded to a server?
No. Your JSON is formatted inside your browser on your own device. It is never sent to Teasoft or anyone else, so it is safe to use with private API responses and customer data.
What is the difference between beautify and minify?
Beautify adds indentation and line breaks so JSON is easy to read and edit. Minify removes all unnecessary whitespace so the JSON is as small as possible for APIs and storage.
How do I validate JSON?
Paste your JSON and click Validate. Valid JSON shows the number of keys, objects and arrays and the nesting depth. Invalid JSON shows the first error with its line and column.
Does formatting change my JSON data?
No. Only whitespace changes, so keys, values and their order stay the same. The only exception is Sort keys A–Z, which reorders keys but keeps every value.
Can it fix invalid JSON?
Yes. Tick Repair common mistakes to fix comments, trailing commas, single-quoted strings, unquoted keys, missing commas and values like None, True, undefined or NaN. The tool lists every fix it made.
Can I view JSON as a tree?
Yes. After you beautify, switch the Result box from Code to Tree. Use Expand and Collapse to open nested objects and arrays, and copy the path of any key.
Can I sort JSON keys alphabetically?
Yes. Tick Sort keys A–Z under JSON options. Keys in every nested object are sorted, and the order of items in arrays is never changed.
Can I use tabs instead of spaces?
Yes. Under Indentation, choose 2 spaces, 4 spaces or Tab.
Are large numbers kept exactly?
Yes. Long IDs and high-precision numbers are kept exactly as written. Many tools use JSON.parse, which rounds whole numbers larger than 9,007,199,254,740,991.
Why does it say my JSON is invalid?
Common causes are a trailing comma, a missing comma or bracket, single quotes instead of double quotes, unquoted keys or comments. The error shows the line and column, or you can tick Repair common mistakes to fix it automatically.
What will my downloaded file be called?
The result is saved as formatted.json, whether you beautified or minified it. You can rename it, for example to data.min.json.
How large can my JSON file be?
You can open files up to 10 MB, paste up to 5 million characters and format JSON nested up to 1,000 levels deep. Very large files depend on your device's memory.
Can I format JSON on my phone?
Yes. It works in Chrome and Safari on Android and iPhone. Paste your JSON, tap Beautify JSON, then copy or download the result.
Do I need to install any software?
No. Everything runs in your web browser on Windows, Mac and Linux. There is nothing to download or install and no account to create.
Does it support JSON with comments (JSONC) or JSON5?
Strict JSON is required, but Repair common mistakes removes comments and trailing commas, quotes keys and converts single quotes, so most JSONC and JSON5 files can be turned into valid JSON.
Can I beautify and then minify the same JSON?
Yes. After you beautify or repair, click Use as input to move the result into the input box, then click Minify.
About Teasoft's JSON Formatter
Teasoft's JSON Formatter is a free online tool to beautify, minify, validate and repair JSON, with a built-in tree viewer. It uses Teasoft's own lightweight JSON parser, which reports errors by line and column and keeps big numbers exact, all running inside your web browser, so it works on Windows, Mac, Linux, Android and iPhone without installing anything.
It is made for anyone who works with JSON: developers debugging APIs and webhooks, testers checking responses, data analysts reading exports, WordPress and no-code users editing settings files, and students learning how JSON works. No account and no paid upgrade are needed.
Your JSON is processed on your device and is never uploaded. A quick Cloudflare Turnstile check keeps the tool free from bots, and your formatted file is saved straight to your device.