Skip to content

Developer Tools

JSON Formatter

Pretty-print and minify JSON in the browser.

Your information is processed in your browser and is not uploaded to our servers.

JSON

Indentation

Valid JSON.

Your JSON stays in your browser and is not uploaded. For the parse error without formatting, use the JSON Validator.

Formatted output

About this tool

This JSON formatter online pretty-prints or minifies JSON in your browser. Your JSON stays in your browser and is not uploaded. Valid text can be formatted with 2 or 4 spaces, or minified. Invalid text shows the parser message, including a line and column when the error includes a character position.

How to use

  1. Paste JSON or start from the sample.
  2. Choose 2 or 4 spaces, then Format. Minify removes the extra whitespace.
  3. Copy the output, or Clear to start again.

Formula and methodology

JSON.parse, then JSON.stringify with 2 spaces, 4 spaces, or no extra space for minify. This checks JSON syntax only. It does not check an API schema.

Worked example

Formatting { "name": "John", "age": 30 } with 2 spaces puts each property on its own line. Minify returns {"name":"John","age":30}.

How to Format JSON Online

Paste the text, then choose Format. Valid JSON is reprinted with the indentation you selected. Minify is the same parse with the whitespace removed, which keeps the data and drops the line breaks.

JSON Formatter vs JSON Validator

This page formats and minifies, and it reports a parse error when the text is not JSON. The JSON Validator is the page for that error alone, without rewriting the text. Neither page checks that the fields match a schema.

Valid JSON Example

{"name":"John","age":30,"tags":["a","b"]} is valid. {"name":"John",} is not, because of the trailing comma. {name:"John"} is not, because the key is missing double quotes.

Frequently asked questions

Does this send my JSON to a server?+

No. Parsing stays in the tab.

Are comments allowed?+

Standard JSON.parse does not allow comments or trailing commas.

Guides

Related tools