You hit an API endpoint. You get back a wall of minified JSON — thousands of characters on a single line with no whitespace. Now you need to actually read it. Here is how to turn that mess into clean, indented, readable JSON in seconds.
APIs return minified JSON to save bandwidth. That is great for machines, but terrible for developers debugging, exploring, or documenting an API. A typical REST API response from a service like Stripe, GitHub, or Shopify might look like this:
Good luck finding the trial_ends date or checking the subscription status in that. Now compare with the formatted version:
Same data. Completely different experience. You can immediately see the structure, find specific fields, verify nesting levels, and spot anomalies.
Paste your JSON into the Pure-Flon JSON Formatter. It validates and formats instantly, entirely in your browser. No data is uploaded to any server. Ideal when you are working with API keys, tokens, or user data that should not leave your machine.
Pipe your API response through jq or Python. Both produce indented, readable output directly in your terminal:
In VS Code: open a .json file, press Shift+Alt+F (Windows/Linux) or Shift+Option+F (Mac) to auto-format. In JetBrains IDEs (WebStorm, IntelliJ): Ctrl+Alt+L / Cmd+Option+L. This reformats the entire file with proper indentation.
Sometimes the JSON you get from an API is not just minified — it is broken. Maybe you copied it incorrectly, or the API returned an error wrapped in HTML. Here are the most common JSON syntax errors and how to fix them:
| Error | Example | Fix |
|---|---|---|
| Trailing comma | {"a": 1, "b": 2,} |
Remove the comma after the last item. JSON does not allow trailing commas (unlike JavaScript). |
| Single quotes | {'name': 'Jane'} |
Replace all single quotes with double quotes. JSON requires double quotes for strings and keys. |
| Unquoted keys | {name: "Jane"} |
Wrap all keys in double quotes: {"name": "Jane"}. This is valid JavaScript but not valid JSON. |
| Missing comma | {"a": 1 "b": 2} |
Add a comma between key-value pairs: {"a": 1, "b": 2}. |
| Comments | {"a": 1 // count} |
Remove all comments. JSON does not support comments of any kind (use JSONC or JSON5 if you need them). |
| HTML wrapping | <html>...{"error":"..."} |
The API returned an error page instead of JSON. Check the HTTP status code and Content-Type header. |
A good JSON formatter catches all of these and shows you the exact line and character where the error occurs, so you know exactly what to fix.
When your code gets an unexpected response from a third-party API, the first step is to look at the raw response. Formatting it reveals the structure immediately — you can see if a field is missing, nested differently than you expected, or returning an unexpected type (string instead of number, array instead of object).
When evaluating a new API (Stripe, Twilio, OpenAI, GitHub), you hit endpoints in Postman or curl to understand the response structure. Formatting the response lets you map out the data model before writing any code. It is much faster than reading API docs for complex nested objects.
API documentation needs formatted JSON examples. Copy the raw response, paste into the formatter, and you get clean indented JSON ready for your docs. Consistent 2-space or 4-space indentation makes documentation look professional and is easier to diff when responses change.
When you need to compare API responses (before/after a change, staging vs production, v1 vs v2), formatting both consistently makes differences immediately visible. Format both with the same indentation, then use a diff tool. Without formatting, even identical responses with different whitespace will show false differences.
Many tools use JSON for config files (package.json, tsconfig.json, .eslintrc.json). When you edit these by hand, proper formatting prevents syntax errors and makes git diffs cleaner. A formatter catches mistakes before your build tool throws a cryptic parse error.
If you work with APIs daily, jq is essential. Here are the most useful patterns for processing API responses on the command line:
For quick one-off formatting where you already have the JSON copied, an online formatter is faster than opening a terminal. For repeated API work, jq is unbeatable.
APIs minify JSON to reduce payload size and transfer time. Removing whitespace, newlines, and indentation can shrink a response by 10-30%. This matters at scale — an API serving millions of requests per day saves significant bandwidth by stripping formatting. The JSON is functionally identical whether minified or pretty-printed; formatting is purely for human readability.
Yes. Formatting (pretty printing) takes valid JSON and adds indentation and line breaks to make it readable. Validation checks whether a string is valid JSON at all — catching issues like missing commas, unquoted keys, trailing commas, or mismatched brackets. A good JSON formatter does both: it validates first, then formats. If the JSON is invalid, it shows you exactly where the syntax error is.
Yes. JSON formatters handle any nesting depth. Deeply nested structures are actually where formatters provide the most value — trying to read a 10-level-deep minified JSON string without formatting is nearly impossible. The Pure-Flon formatter processes everything client-side, so even large deeply-nested payloads format instantly without upload limits.
Like free tools with no ads? Support the project