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
| Code | Meaning |
|---|---|
{ } | An object, which holds key-value pairs. |
[ ] | An array, which holds values in order. |
"key" | Keys must be wrapped in double quotes. |
null | An explicit empty value, which is not the same as an empty string. |
true / false | Boolean values, written without quotes. |
Trailing comma | Not valid JSON. A comma after the last item makes the whole document invalid. |
Indent | Formatting 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:
- 1Paste your JSON into the box.
- 2Pick Format, Minify or Validate.
- 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
Base64 Encoder
Encode any text, including Unicode, to Base64.
Hash Generator
Generate MD5, SHA-1 and SHA-256 hashes of any text.
Regex Tester
Test regular expressions against text with live matches.
Base64 Decoder
Decode Base64 strings back to readable text.
URL Encoder
Encode text for safe use inside URLs and query strings.
URL Decoder
Decode percent-encoded URLs back to readable text.