JSON Formatter and Validator: Free and Private

Use this json formatter & validator to make JSON easy to read and spot mistakes fast. Paste JSON to pretty print it with clean indents, see errors with line numbers, view it as a tree, or minify it. Everything runs in your browser.

JSON Formatter & Validator

Beautify, minify and validate JSON.

or drop a file here
The tool follows the strict JSON standard: comments, trailing commas and single quotes are reported as errors. Very large integers (over 9,007,199,254,740,991) lose precision when parsed by JavaScript.
Everything runs in your browser. Nothing you enter or upload is sent to a server.

How to use the JSON formatter

  1. Paste your JSON into the top box, or open a .json file.
  2. Choose 2 spaces, 4 spaces or tabs, and tick Sort keys if you want keys in alphabetical order.
  3. Press Format to beautify, Minify to remove all whitespace, or Validate to only check it.
  4. If there is an error, the message shows the line and column. Otherwise copy or download the result.

How it works

Your JSON is parsed with the browser’s built-in JSON parser, which follows the official JSON specification (RFC 8259). If parsing fails, the error position is converted into a line and column so you can find the problem quickly. Valid data is written back with JSON.stringify using your indentation, or with no whitespace for minified output. Sorting rebuilds every object with its keys in alphabetical order.

Example

The one-line input {"name":"Toolverse","free":true,"tools":["QR code","JSON formatter"]} formats into five readable lines with 2-space indentation. Removing the closing bracket gives an error pointing to the end of line 1.

Frequently asked questions

Is my JSON sent to a server?

No. Formatting and validation run in your browser, so API keys, tokens or private data in your JSON stay on your device.

Why is my JSON invalid?

Common causes are trailing commas, single quotes instead of double quotes, comments, unquoted keys, or a missing bracket. The error message shows where the parser stopped.

What is the difference between format and minify?

Format adds line breaks and indentation for humans. Minify removes all unnecessary whitespace to make the file as small as possible for apps and APIs.

How large a file can it handle?

Files up to about 20 MB work well on most computers.

See also: Hex Calculator, Binary Calculator.

Format and check JSON

How to use it

  1. Paste your JSON.
  2. Format or minify it.
  3. Fix errors shown by line.
  4. Copy or download.

More questions

Why is my JSON invalid?

Common causes are trailing commas and single quotes.

Can I minify it?

Yes. Remove all spaces with one click to minify your JSON.

Is my data uploaded?

No. Your JSON stays in your browser and is never uploaded.

Related tools: CSV to JSON Converter (and JSON to CSV), YAML to JSON Converter, XML Formatter and Validator.

A small object, formatted and minified

Paste your JSON, then choose Format, Minify or Validate. Set the indent to 2 spaces, 4 spaces or a tab, and turn on key sorting if you want. To convert XML data into JSON first, use the XML to JSON Converter.

Worked example: {"b":2,"a":{"y":1,"x":[1,2]}} formats with a 2-space indent into a 10-line block and reports Valid JSON: 7 values, 72 B. Minifying it returns the 29-byte original.

More answers

How do I sort the keys alphabetically?

Turn on the sort option, then press Format. The same sample then lists "a" before "b" and, inside it, "x" before "y".

What does the message under the result mean?

It confirms the JSON is valid, counts the values and shows the size of the result. For the sample, formatting shows 72 B and minifying shows 29 B.