JSON Formatter (Beautify, Validate & Minify)

Paste your JSON and click Beautify to get neatly indented output. If the syntax is invalid, the tool shows the line and column of the error.

Indentation
Options

How to use the JSON Formatter

  1. Paste your JSON into the input box above. It can be anything: an API response, a config file, a log entry and so on.
  2. Pick an indentation style (2 spaces, 4 spaces or tab) and click Beautify to get cleanly formatted output.
  3. If there is a syntax error, a red message shows the line and column of the error, and the cursor jumps to that spot in the input box.
  4. To make the payload smaller, click Minify to strip out all spaces and line breaks. You can copy the result or save it as a .json file.

Common JSON syntax errors

JSON looks a lot like JavaScript object notation, but its rules are stricter. If validation fails, check these common mistakes first.

InvalidValidWhy
{'name': 'smith'}{"name": "smith"}Strings and keys must use double quotes
{name: "smith"}{"name": "smith"}Keys need quotes too
[1, 2, 3,][1, 2, 3]Trailing commas aren't allowed
{"a": undefined}{"a": null}undefined, NaN and Infinity aren't valid values
// comment(remove it)JSON doesn't support comments
{"n": 012}{"n": 12}Numbers can't have leading zeros

The reported position is the first place where a rule breaks. The real mistake may be earlier, such as a missing closing bracket, so check the line just above the one shown as well.

When should you beautify or minify JSON?

Beautify (also called pretty printing) is for people. Use it to inspect API responses, edit config files or explain a data structure in a code review. Match your team's style for indentation: JavaScript projects usually use 2 spaces, and Python projects often use 4.

Minify is for machines. It removes every space and line break to make the data smaller, which helps when you send it over a network, write it to a log as a single line or store JSON in an environment variable. The data means exactly the same thing as the beautified version.

Sort keys alphabetically reorders the keys in every object. This keeps diffs clean when you compare two JSON files, because differences in key order no longer show up as changes. Array items stay in their original order, since order in an array is meaningful.

JSON data types at a glance

  • Object { }: a collection of "key": value pairs. Keys must be strings.
  • Array [ ]: an ordered list of values. You can mix different types.
  • String: wrapped in double quotes. Write a line break as \n and a double quote as \". Accented letters, other non-English text and emoji can be used as is.
  • Number: integers, decimals and exponent notation (1e3) are allowed. If you add quotes, the value becomes a string.
  • true / false / null: always lowercase.

To turn spreadsheet data from Excel or Google Sheets into JSON, try the CSV to JSON converter. To pull JSON out of an encoded token, use the Base64 decoder.

Frequently asked questions

Is my JSON sent to a server?
No. Formatting and validation happen entirely in your browser, so JSON that contains API keys or personal data never leaves your device.
Can it handle very large JSON files?
Files of a few MB work fine. At tens of MB or more your browser may slow down, so it's best to format only the part you need.
Why does the error position differ from where my mistake actually is?
The validator reports the first point where a rule breaks. For example, a missing comma triggers an error where the next key starts, so check the text just before the reported position.
Does it support JSON with comments (JSONC)?
Standard JSON doesn't allow comments, so they're flagged as errors. Remove the comments (// or /* */) and then beautify again.
Is this the same as a JSON validator or JSON lint tool?
Yes. Every time you click Beautify or Minify, the tool checks your JSON, and it tells you whether it's valid and where the first error is.

Last updated: 2026-10-06