JSON Formatter / Minifier
How do I format JSON?
Result
How it is calculated
The tool parses the text as JSON and writes it back out in one of two layouts. In minify mode all optional whitespace is removed, giving the shortest valid text. In pretty mode it adds line breaks and four-space indentation, one key per line. If the text is not valid JSON, for example it has single quotes, a trailing comma or an unquoted key, the tool shows an invalid message instead of guessing a fix. Keys keep their original order and every value is kept exactly as typed: {} stays {}, 1.0 stays 1.0, big integers keep all their digits, and strings are copied with their escapes unchanged. Empty input returns nothing.
Worked example
Input: { "name": "Ada", "age": 36 } with mode set to minify. The text is valid JSON: an object with two keys. The spaces after the braces, colons and commas are not needed, so they are removed. The output is {"name":"Ada","age":36}, 23 characters instead of 28. In pretty mode the same data would be printed on four lines with indentation.
Common mistakes
- Pasting JavaScript object syntax such as
{name: 'Ada'}. JSON needs double quotes around keys and strings. - Leaving a trailing comma after the last item, which is invalid and gives an error.
- Expecting the tool to repair broken JSON. It only reports it as invalid.
- Minifying a file that contains comments. Standard JSON has no comments, so it fails to parse.
About this calculator
This tool takes a block of JSON text and either pretty-prints it — adding indentation and line breaks so nested objects and arrays are readable — or minifies it down to a single compact line, and it flags syntax errors like a missing comma or an unclosed bracket that would otherwise make the JSON fail to parse.
Developers use the pretty-print side constantly when inspecting an API response, a config file, or a webhook payload that arrives as an unreadable single-line string, and use the minify side when preparing JSON to ship in production — smaller payloads mean less bandwidth and faster load times. It's also a fast way to check whether a hand-edited config file or a copy-pasted API response is actually valid JSON before it causes a parsing error somewhere else in the code.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
When the tool reports invalid JSON, it does not say where the problem is. A reliable way to find it is to cut the text in half, test each half as its own piece, and repeat on the half that fails. The text is processed on our server, so remove passwords, API tokens and personal data before pasting anything. Which kind of JSON do you format most often: API responses, config files or logs?