JSON formatter
Format, validate and minify JSON instantly. Paste raw JSON and get it prettified with one click.
Ctrl + Enter format | Ctrl + Shift + M minify | Ctrl + L clear
How to format JSON online
Paste your raw or minified JSON into the input panel and click Format / Prettify. The tool parses your JSON and outputs it with proper indentation, line breaks, and consistent spacing — making it immediately readable and easy to navigate. Choose between 2-space indentation (the most common standard), 4-space indentation (preferred in many style guides), or tab indentation depending on your project conventions.
Live JSON validation
The status bar validates your JSON automatically as you type, with no button press required. A green dot and checkmark indicates valid JSON. A red dot shows invalid JSON with the exact error message from the browser's JSON parser — including the position of the first syntax error. This lets you identify and fix problems before formatting. Common errors include trailing commas after the last item, single quotes instead of double quotes, unquoted property names, and unescaped backslashes in strings.
Minifying JSON for production
Click Minify to remove all whitespace from your JSON and produce the most compact possible output. The stats bar shows the size reduction. Minified JSON transmits faster over networks, uses less bandwidth for APIs, and reduces payload size for applications. For large JSON objects the size reduction from removing whitespace can be significant — a 100KB prettified file might minify to 60KB. Always keep a prettified version for development and use minified JSON for production API responses.
Understanding the JSON stats
The stats bar below the panels shows four metrics about your JSON structure. Keys shows the total number of property names across all objects. Values shows the total number of values including strings, numbers, booleans, nulls, arrays, and objects. Depth shows how many levels of nesting your JSON has — deeply nested JSON (depth 6+) can be a sign of overly complex data structures. Arrays shows how many array elements are present across all arrays in the document.
Common JSON errors and fixes
Trailing commas are the most common error — JSON does not allow a comma after the last item in an array or object. JavaScript allows this but JSON does not. Single quotes are invalid in JSON — all strings including property names must use double quotes. Undefined and NaN are not valid JSON values — use null instead. Comments are not supported in JSON — remove any // or /* */ style comments before parsing. Property names must always be quoted strings — {name: "value"} is invalid, {"name": "value"} is correct.
Frequently asked questions
How do I format JSON online?
Paste your JSON into the input panel and click Format. Choose your indentation style and the formatted result appears instantly in the output panel.
What is the difference between prettify and minify?
Prettify adds indentation and line breaks for human readability. Minify removes all whitespace for the smallest possible file size. Use prettify for development, minify for production.
Why is my JSON invalid?
Common causes: trailing commas, single quotes instead of double quotes, unquoted property names, unescaped backslashes, or missing/extra braces and brackets. The error message shows the exact position of the first problem.
Can I validate JSON without formatting it?
Yes. The tool validates automatically as you type and shows errors in the status bar without you needing to click anything.
What is JSON?
JSON stands for JavaScript Object Notation. It is a lightweight text format for storing and transmitting structured data, and is the standard format for APIs and web services.