JSON Formatter

Paste messy or minified JSON to format it with clean indentation, minify it, sort its keys or find syntax errors.

Updated 100% free Files stay on your device No sign-up

Watch the 0:31 video tutorial
JSON Formatter illustration
Input JSON
Output

How to use the JSON Formatter (video)

0:31 · no sound needed
In this video
  1. Paste your JSON
  2. Click Beautify for clean, indented JSON
  3. Click Validate to check for errors
  4. Copy or download the result

Popular JSON Formatter shortcuts

Format and validate JSON online

JSON (JavaScript Object Notation) is the standard format for APIs, config files and data exchange. Responses from APIs are usually minified onto one line, which makes them hard to read. This JSON formatter adds indentation and line breaks, and the validator tells you exactly where a syntax error is.

How to use the JSON formatter

  1. Paste your JSON into the left box.
  2. Click Beautify to format it, Minify to compress it, or Sort keys to order object keys alphabetically.
  3. Click Validate to check the syntax. Errors show the line and column.
  4. Copy or download the result.

Common JSON errors and how to fix them

  • Trailing commas – {"a": 1,} is invalid. Remove the last comma.
  • Single quotes – JSON needs double quotes: "name", not 'name'.
  • Unquoted keys – {name: "x"} must be {"name": "x"}.
  • Comments – standard JSON does not allow // or /* */ comments.
  • Special values – undefined, NaN and functions are not valid JSON.

Beautify or minify?

Beautified JSON is easy to read and debug. Minified JSON removes all spaces and line breaks for the smallest size, which is best for production APIs and storage. Your data stays in your browser, so it is safe to paste API responses and config files. For web code, try the HTML minifier and CSS minifier.

Before and after

Minified:

{"user":{"id":42,"name":"Sara","roles":["admin","editor"]},"active":true}

Beautified:

{
  "user": {
    "id": 42,
    "name": "Sara",
    "roles": ["admin", "editor"]
  },
  "active": true
}

JSON syntax rules in brief

  • Data is written as key/value pairs: "name": "Sara".
  • Keys and string values use double quotes.
  • Allowed values: string, number, true, false, null, object {} and array [].
  • Items are separated by commas, with no comma after the last item.

Features

  • Beautify with 2 spaces, 4 spaces or tabs.
  • Minify to the smallest size for APIs and storage.
  • Sort keys alphabetically at every level, making two JSON files easy to compare.
  • Validate with clear errors that include the line and column. See the JSON validator guide for common fixes.
  • Download the result as a .json file.

Common uses

Reading API responses, editing configuration files for apps and plugins, preparing test data, checking webhooks, and reviewing JSON-LD structured data before adding it to a website. Because everything runs in your browser, it is safe to paste JSON containing tokens or customer information.

Frequently asked questions

Why is my JSON invalid?

The most common causes are trailing commas, single quotes instead of double quotes, unquoted keys and comments. The validator shows the line and column of the first error.

Is my JSON data sent anywhere?

No. Formatting and validation happen in your browser, so API keys and private data stay on your device.

What is the difference between beautify and minify?

Beautify adds indentation and line breaks for readability. Minify removes all unnecessary whitespace for the smallest size.

Can I choose the indentation?

Yes. Choose 2 spaces, 4 spaces or tabs before clicking Beautify.