Format and Validate JSON

Turn a one-line API response into readable, indented JSON, or squeeze a config file down to one line. If the JSON is broken, you get the line and column where parsing failed.

  • Free
  • Runs in your browser
  • Error line and column
  • No sign-up
How it works

How It Works

Clean up JSON in three steps.

01

Paste your JSON

From an API response, a log line, a .json file or a database field.

02

Format or minify

Pick the indent and optionally sort keys, then press Format, or press Minify for one line.

03

Copy or download

Copy the result or save it as a .json file.

About

What does a JSON formatter do?

JSON from an API usually arrives on a single line with no spaces, which is fine for machines and unreadable for people. A formatter parses it and writes it back out with one key per line and nested objects indented, so you can see the structure. Because it has to parse the JSON first, it also works as a validator: if parsing fails, the text is not valid JSON and the error tells you where.

This is strict JSON. Comments, trailing commas and single-quoted strings are not allowed by the JSON standard, so they are reported as errors. Those come from JSON5 or JavaScript object syntax.

Error position

Shows the line and column of the first syntax error, such as a missing comma or an unquoted key.

Sort keys

Orders the keys of every object alphabetically, which makes two JSON files much easier to compare.

Minify

Removes all whitespace for the smallest payload, for example before storing JSON in a database column.

Your indent

2 spaces, 4 spaces or tabs, to match your project's style.

Features

Why Use This JSON Formatter

Readable JSON and clear errors.

Private

API responses often contain tokens or personal data. Here they are parsed in your browser and never uploaded.

Finds the error

A line and column number beat scanning thousands of characters for a missing bracket.

Sorted keys

Recursive key sorting for stable output you can diff.

Save as a file

Download the formatted result as formatted.json.

✓ No Registration✓ Free✓ Browser-based✓ Text Stays Local
FAQ

Frequently Asked Questions

Questions people ask about the JSON Formatter.

JavaScript objects allow things JSON does not: comments, trailing commas, single quotes and unquoted keys. Remove them, or put keys and strings in double quotes.