❯
❯
JSON
Code Formatting
Formatter Tool

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.

100% Free

No Sign-Up, No Install

Beautify & Minify

Plus Validate & Repair

Private & Secure

JSON Never Leaves Your Browser

Your Code Style

2 Spaces, 4 Spaces or Tabs

0 characters 0 lines 0 B
Result
0 B 0 lines
Settings
Indentation
JSON options

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 JSONWhen you beautifyWhen you minify
Indentation and line breaksRebuilt with 2 spaces, 4 spaces or a tab for each nesting level.Removed, so the JSON fits on one line.
Keys and valuesKept exactly. Keys are sorted only if you tick Sort keys A–Z.Kept, with the spaces around { } [ ] : and , removed.
Short arraysPut on one line if you tick Short arrays on one line and they fit in 80 characters.Always on one line.
StringsUnchanged, including escape sequences and Unicode.Unchanged.
Large numbersKept exactly as written, even beyond JavaScript’s safe integer limit.Kept exactly as written.
Comments and trailing commasReported 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

What each control does:

ControlWhat it doesWhen to use it
JSON input boxHolds the JSON you want to format and shows its characters, lines and sizePaste, type or drop a file here.
Upload, Paste, Sample and ClearOpens a .json, .geojson or .txt file, pastes from your clipboard, loads example JSON or empties the boxClick Sample to try the tool before using your own data.
IndentationSets 2 spaces, 4 spaces or a tab for each levelMatch your project’s code style or .editorconfig.
End with a new lineAdds a final line break to the resultKeeps Git, linters and editors happy.
Sort keys A–ZSorts object keys alphabetically at every levelCompare two JSON files or keep config files tidy.
Repair common mistakesFixes comments, trailing commas, single quotes, unquoted keys, missing commas and values like None or undefinedClean up JSON copied from JavaScript, Python or a hand-edited file.
Short arrays on one lineKeeps arrays of simple values on one line when they fit in 80 charactersMake coordinates, tags and number lists more compact.
Beautify JSON, Minify and ValidateFormats, compresses or checks your JSONPress Ctrl + Enter inside the input box to beautify quickly.
Code and Tree viewsShows the result as text or as a collapsible tree with Expand and CollapseUse Tree to explore nested data and copy the path of a key.
Copy, Download and Use as inputCopies the result, saves it as formatted.json or moves it back into the inputUse as input lets you repair, then minify, without copy and paste.

Good to know

What You Can Do With This Tool

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?

TaskUseWhy
Read a one-line API responseBeautify JSONAdds indentation and line breaks so every key and value is easy to find.
Explore deeply nested dataTree viewExpand only the parts you need and copy the path to any key.
Make JSON smaller for a request or databaseMinifyRemoves all unnecessary whitespace to cut payload size.
Find why JSON.parse failsValidatePoints to the first error by line and column, such as a missing comma or quote.
Fix JSON copied from JavaScript or PythonRepair common mistakesRemoves comments and trailing commas, quotes keys and converts single quotes, None and undefined.
Compare two JSON filesSort keys A–ZPuts keys in the same order so a diff shows only real changes.
Check required fields and data typesA JSON Schema validatorValidate checks syntax only, not whether the data matches a schema.

Getting better results when you format JSON

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

Paste your JSON into the input box, choose your indentation, then click Beautify JSON. Copy the result or download it as formatted.json.

Yes. It is completely free, with no sign-up and no limit on how often you use it.

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.

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.

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.

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.

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.

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.

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.

Yes. Under Indentation, choose 2 spaces, 4 spaces or Tab.

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.

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.

The result is saved as formatted.json, whether you beautified or minified it. You can rename it, for example to data.min.json.

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.

Yes. It works in Chrome and Safari on Android and iPhone. Paste your JSON, tap Beautify JSON, then copy or download the result.

No. Everything runs in your web browser on Windows, Mac and Linux. There is nothing to download or install and no account to create.

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.

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.