All tools / Developer

JSON Formatter

Validate, format or minify JSON data.

How to format JSON

  1. Paste your JSON into the box.
  2. Choose Pretty print to indent it, or Minify to remove all spacing.
  3. Press Run tool. If the JSON is valid, you get the formatted result. If not, you get an error message.

Pretty print uses two-space indentation, which is the most common style in JavaScript projects and WordPress block files. Minify puts everything on one line with no extra spaces.

Validation: what counts as valid JSON

The tool uses your browser's standard JSON parser, which follows the JSON specification strictly. These are the most common mistakes:

When parsing fails, the error message usually includes a position or line number. Go to that spot and look just before it. The real mistake is often one character earlier, such as a missing comma at the end of the previous line.

Where WordPress users run into JSON

You do not need to be a developer to deal with JSON. It turns up all over a WordPress site:

A single misplaced comma in theme.json can make WordPress quietly ignore the whole file. Validating it here first is quicker than wondering why your colours did not change.

Pretty print or minify?

Use pretty print when a person needs to read, review or edit the data. Use minify when the data is going into a config field, an API request or an HTML attribute where size or a single line matters. Minifying usually saves 10 to 30 percent of the size, depending on how deeply the data is nested. For files served to browsers, gzip or Brotli compression on the server saves far more, so do not minify a file just for speed if your host already compresses it.

Limits to know about

Frequently asked questions

Is my JSON sent anywhere?

No. Parsing and formatting happen in your browser. That makes the tool safe for API responses that contain tokens or customer data, although you should still be careful where you paste secrets.

Can it fix invalid JSON automatically?

No. Automatic repair can guess wrong and change your data. The tool points to the problem so you can fix it yourself.

Related tools

Text

Word Counter

Count words, characters, sentences and reading time.

Open tool →
Text

Case Converter

Convert text to uppercase, lowercase, title or sentence case.

Open tool →
Text

Duplicate Line Remover

Remove repeated lines while preserving their order.

Open tool →