JSON Formatter

Format JSON online: beautify messy JSON with 2 or 4 spaces or tabs, sort keys, minify it to one line and find errors. Free, runs in your browser.

Runs in your browser. Your data never leaves your device.

How to use the JSON Formatter

  1. Paste your JSON into the box.
  2. Pick the indent (2 spaces, 4 spaces or tabs) and tick Sort keys A–Z if you want the keys in order.
  3. Press Format to beautify, Minify for one line, or Validate to check it.
  4. Copy the result or download it as a .json file.

About this tool

Paste JSON from an API, a log or a config file and press Format to get clean, indented JSON that is easy to read. Choose 2 spaces, 4 spaces or tabs, sort the keys A to Z, or press Minify to put the JSON back on one line for sending or storing. If the JSON has a mistake, the formatter shows the line and column. Your data stays in your browser, which matters when the JSON holds tokens or customer details.

What JSON format looks like

JSON (JavaScript Object Notation) is text with a few strict rules: objects in curly braces with keys in double quotes, arrays in square brackets, and values that are strings, numbers, true, false, null, objects or arrays. There are no comments and no trailing commas. Formatting only adds spaces and line breaks; the data stays exactly the same. An example:

{
  "id": 1024,
  "name": "Wireless Mouse",
  "price": 19.99,
  "inStock": true,
  "tags": ["usb", "office"],
  "seller": { "name": "Acme", "rating": 4.6 }
}

Format JSON in VS Code, Notepad++ or a terminal

VS Code formats a .json file with Format Document (Shift+Alt+F on Windows, Shift+Option+F on a Mac). Notepad++ needs a plugin: open Plugins > Plugins Admin, install JSON Viewer, then use Plugins > JSON Viewer > Format JSON. On a computer or server with Python, json.tool beautifies a file, and jq does it with colours if you have it installed.

python3 -m json.tool data.json              # beautify with 4 spaces
python3 -m json.tool --indent 2 data.json   # beautify with 2 spaces
jq . data.json                              # beautify with jq
jq -c . data.json                           # minify to one line

Viewers, extensions and comparing JSON

Firefox shows a JSON address as a readable, collapsible view by itself, and browser extensions add a JSON viewer to Chrome. To compare two JSON files, format both here with Sort keys ticked and put them side by side in any diff tool, such as Compare Selected in VS Code: with the keys in the same order, only the real differences stand out. There's nothing to download; the formatter works in any browser, on a phone too.

GuideHow to Self-Host n8n on a Cheap VPS (Docker Compose with HTTPS)

Frequently asked questions

How do I format a JSON file?

Open the file, copy its text into the box above and press Format, then press download to save the formatted .json file. In VS Code, open the file and use Format Document.

What is JSON format?

A text format for data made of objects ({ }), arrays ([ ]) and values: strings in double quotes, numbers, true, false and null. Web APIs and config files use it everywhere.

Can you beautify JSON?

Yes. Beautifying only adds indentation and line breaks, so the data doesn't change. Minify removes them again.

Can I beautify JSON in Notepad++?

Yes, with a plugin. Install JSON Viewer from Plugins > Plugins Admin, then choose Plugins > JSON Viewer > Format JSON.

What is the difference between format and minify?

Format adds spaces and line breaks for people to read. Minify removes them to make the file as small as possible for sending or storing.

Is my JSON sent to a server?

No. Formatting happens in your browser.

More json tools

JSON and code models

All 31 free tools →
JSON tool · Runs in your browser

JSON Validator

Check if JSON is valid and see the exact line and column of any error, with a hint on how to fix it. A free online JSON validator in your browser.

Free · No sign-upOpen tool
JSON tool · Runs in your browser

JSON to Kotlin Data Class

Paste JSON and get Kotlin data classes for Android, with kotlinx.serialization, Gson or Moshi names, nullable fields and defaults. Free, in your browser.

Free · No sign-upOpen tool
JSON tool · Runs in your browser

JSON to Dart (Flutter)

Convert JSON to null-safe Dart model classes for Flutter, with fromJson, toJson and an optional copyWith. Free, no sign-up, runs in your browser.

Free · No sign-upOpen tool
JSON tool · Runs in your browser

JSON to Swift (Codable)

Turn JSON into Swift Codable structs or classes, with CodingKeys for snake_case keys. Free JSON to Swift converter for iOS and macOS apps.

Free · No sign-upOpen tool