Skip to content

JSON Formatter

Paste any JSON and choose Format to pretty-print it with indentation, Minify to compress it, or Validate to check it. Syntax errors are reported with the exact location. Everything runs locally in your browser.

What each field means

Every input below changes the result in a specific way. This is what each one expects, what it starts at, and the range it accepts.

JSON input

Text that you supply. The calculator works on exactly what you type.

How to read your result

The calculator reports the figures below. The headline figure answers the question in the title; the rows underneath break it down so you can see what drives it.

Formatted JSON
This figure updates as you change the inputs above. It is a direct output of the formula, not an estimate of future market or lender outcomes.
Output size
This figure updates as you change the inputs above. It is a direct output of the formula, not an estimate of future market or lender outcomes.
Input size
This figure updates as you change the inputs above. It is a direct output of the formula, not an estimate of future market or lender outcomes.
Characters saved
This figure updates as you change the inputs above. It is a direct output of the formula, not an estimate of future market or lender outcomes.
Characters saved
This figure updates as you change the inputs above. It is a direct output of the formula, not an estimate of future market or lender outcomes.
Lines
This figure updates as you change the inputs above. It is a direct output of the formula, not an estimate of future market or lender outcomes.

Quick reference

CodeMeaning
{ }An object, which holds key-value pairs.
[ ]An array, which holds values in order.
"key"Keys must be wrapped in double quotes.
nullAn explicit empty value, which is not the same as an empty string.
true / falseBoolean values, written without quotes.
Trailing commaNot valid JSON. A comma after the last item makes the whole document invalid.
IndentFormatting only changes readability. The parsed data is identical either way.

What this means

JSON is a text format for structured data. Formatting indents nested objects so humans can read them; minifying strips all whitespace so files are smaller; validating checks the text follows the JSON grammar.

How we calculate it

Formula

Format: JSON.parse(text) then JSON.stringify(value, null, 2). Minify: JSON.stringify(value). Validate: JSON.parse succeeds.

Worked example

Paste this and press Format:

  1. 1Paste your JSON into the box.
  2. 2Pick Format, Minify or Validate.
  3. 3The result and any errors appear instantly.

Important assumptions

  • The JSON grammar requires double quotes around keys and strings.

Frequently asked questions

Why is my JSON invalid?

Common causes: single quotes instead of double quotes, a trailing comma, or a missing closing brace. The tool highlights the exact problem.

Can I format large JSON files?

Yes, within reasonable browser memory limits. Huge files over several megabytes may be slow in any tool.

Related tools