JSON Formatter

Format, minify, or validate JSON in your browser. Paste text or open a local file, then copy or download the result.

Input

0 bytes · Local file limit 5 MiB

Output

Output size will appear after formatting or minifying.

Validation checks syntax. Formatting and minifying preserve the original value tokens.

How to use

  1. Paste JSON into the input panel or open a local .json file, up to 5 MiB.
  2. Choose two spaces, four spaces, or tabs and select Format. Use Minify for compact JSON or Validate to check syntax without creating an output.
  3. Review the output and byte count. Select Copy output or Download .json to use the transformed text elsewhere.

How it works

The browser parser checks the syntax first. The formatter then reads the tokens from the original input so it can change spacing without rewriting string escapes, changing numeric literals, or silently replacing repeated keys. The output keeps the original property order.

Use the separate JSON Minifier for a compact-only workflow. If your input is for a webpage’s structured data, the Article JSON-LD Generator can help build an Article draft.

Formula or processing rules

Format inserts indentation and line breaks around structural tokens. Minify removes optional whitespace outside strings. Both preserve whitespace inside quoted values. The byte counters measure UTF-8, so a character and a byte are not interchangeable when the text contains accents or emoji.

Worked example

Paste the 15-byte input below and select Format with two spaces. The output is 20 bytes, including two line breaks. Minify returns it to 15 bytes. If you replace the Boolean field with a numeric ID such as 9007199254740993, the formatter leaves those digits unchanged.

{"active":true}

Limitations and troubleshooting

  • A trailing comma or comment fails validation. Remove comments and trailing commas, and use double quotes around property names and strings. Use the location in the parser message when the browser supplies one.
  • Valid JSON is still rejected by an API. Syntax checking does not verify required properties, value types, or an API schema. Compare the payload with the receiving API’s rules.
  • An imported ID changes later. The formatter preserves numeric tokens, but the receiving application can still round values it reads into an ordinary floating-point number. Use string IDs when the receiving schema allows it.
  • Indentation stops for very deep input. Try Validate or Minify. The formatted view limits nesting and output size to keep the editor responsive.

Frequently asked questions

What is the difference between Format, Minify, and Validate?

Format adds indentation, Minify removes optional whitespace, and Validate checks syntax without creating transformed JSON.

Does the formatter preserve large integers and repeated keys?

It keeps the original tokens and their order. Downstream programs may round large numbers or interpret repeated keys differently, so check what the receiving system expects.

Why are spaces inside a quoted string still there after minifying?

Those spaces belong to the value. Removing the space from "Blue sky" would change the text, so the minifier leaves it alone.

Does it accept top-level arrays or simple values?

Yes. Arrays, objects, strings, numbers, Booleans, and null are supported when written as valid JSON. JavaScript assignments, comments, and unquoted keys are rejected.

Are my input files uploaded?

No. The editor reads a chosen file and processes its content in the current browser page. The download is created from the output in your browser.