JSON Formatter
Format, validate, and minify JSON.
A JSON Formatter takes raw JSON and turns it into something you can actually read. Paste a payload from an API response, a config file, or a log line into the input box, and get a clean, indented version back. It is built for developers who work with JSON every day and want a fast way to inspect, tidy, or shrink data without spinning up a script or reaching for the command line.
This tool does three jobs. Format pretty-prints your JSON with a consistent two-space indent so nested structures are easy to follow. Minify strips every unnecessary space and newline to produce the smallest valid output. Validate checks whether the input is well-formed and, if it is not, tells you exactly where the problem is. Everything runs locally in your browser, so nothing you paste ever leaves your machine.
How to use the json formatter
- Paste or type your JSON into the input textarea at the top of the page.
- Click Format to pretty-print it with two-space indentation, or click Minify to collapse it into a compact single line.
- Click Validate to confirm the JSON is well-formed without changing its layout.
- Read the result in the output textarea below, which updates as soon as you press a button.
- Use the copy control to grab the output and paste it back into your editor, request body, or config file.
- If Validate reports an error, note the line and column it points to, fix that spot in the input, and run it again.
Worked example
Imagine you copy an API response that arrives as one long unbroken line: an object with a 'user' key holding a nested object, and an 'active' key set to true. It is valid, but impossible to scan. Paste it in and click Format. The output textarea now shows the object across several lines, with the nested 'user' object indented two spaces and its own fields indented four, so the shape of the data is obvious at a glance. Switch to Minify and the same content collapses back to a single compact line, ideal for pasting into a request body where size matters. Click Validate on a version with a trailing comma and the tool reports that the input is invalid, pointing to the exact line and column so you can find and remove it.
Common mistakes to avoid
- Leaving a trailing comma after the last item in an object or array. JSON does not allow it, even though JavaScript objects do.
- Using single quotes around keys or string values. JSON requires double quotes on both.
- Writing unquoted keys. Every object key must be a double-quoted string, unlike a JavaScript object literal.
- Including comments. JSON has no comment syntax, so lines starting with two slashes or wrapped in slash-star will fail validation.
- Pasting a value like NaN, Infinity, or a trailing decimal point, none of which are valid JSON numbers.
Frequently asked questions
Is my JSON sent anywhere?
No. Formatting and validation happen locally in your browser.
What is the difference between Format and Minify?
Format adds line breaks and two-space indentation so the structure is easy to read, which is what you want while debugging or documenting. Minify does the opposite, removing all optional whitespace to produce the smallest valid output, which is useful for reducing payload size in requests or storage. Both produce equivalent JSON, only the spacing differs.
What does the line and column in an error message refer to?
When Validate fails, the parser reports the position where it stopped understanding the input. The line counts from the top of your pasted text and the column counts characters across that line. Jump to that spot to find the culprit, though the real mistake is sometimes just before it, such as a missing comma or an unclosed bracket on the previous line.
Can it handle very large JSON files?
Yes, within the limits of your browser. Because all processing happens locally on your device, performance depends on your available memory rather than a server. Most API responses and config files format instantly. Extremely large files, tens of megabytes or more, may feel slow. If you need to generate test tokens or secrets to include in that data, the <a href="/tools/password-generator/">password generator</a> can help.