Format JSON From curl Output
curl is the workhorse HTTP client for API exploration, but its default output is unformatted: response bodies print as a single long line that is nearly impossible to read for any document with more than a handful of fields.
Native JSON tool
JSON Formatter
Runs locally in your browser
No server upload during processing
No server-side file retention
No watermark added
- Cost
- Free tier
- Sign-up
- Not required
- Processing
- Tool-specific
- Privacy
- Clearly disclosed
Add this JSON Formatter to your website
Drop the JSON Formatter into a blog post, product docs, intranet, or school portal with one iframe. Processing, privacy, and usage limits are the same as on the full tool page.
- One copy-ready line of HTML
- Responsive — adapts to any container width
- No API credentials are placed in the snippet
Embed code
<iframe
src="https://www.fixtools.io/json/json-formatter?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="JSON Formatter by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
curl Output Quirks and How FixTools Handles Them
curl prints HTTP response bodies directly to standard output by default, with no formatting and no headers unless you pass the --include flag explicitly. For JSON APIs this means the response body arrives as a single line of text that is parseable but unreadable. Pasting this raw output into FixTools produces a fully formatted view in milliseconds because the tool calls JSON.parse on the input and then JSON.stringify with an indent argument. The validation step also catches the common case where an upstream error has caused the API to return an HTML error page instead of the expected JSON, and reports the parse failure rather than silently producing broken output.
A common source of confusion is the progress meter that curl prints by default to standard error when the output is not a terminal. If you copy from a script that redirects standard error into standard output without the --silent flag, the progress meter may be interleaved with the response body and corrupt the JSON. The fix is to always use --silent for scripting, or --silent --show-error if you still want to see actual network errors. FixTools cannot recover from a body that has progress meter text spliced into the middle, so the parse error in that case is correctly attributed to the contamination rather than to the original response.
curl also handles HTTP redirects only when you pass the -L or --location flag explicitly. Without it, a 301 or 302 response produces an empty body and a redirect header, and pasting an empty body into a formatter is not useful. Always include -L when you are exploring an API endpoint and you do not know whether it redirects. For paginated APIs that return Link headers pointing to the next page, combine curl -L --silent with a --header flag for authentication and a small shell loop to walk pages, then paste each page response into FixTools to inspect the structure.
Windows terminals introduce an additional wrinkle: PowerShell and the legacy cmd shell often translate the Unix line endings in curl output to Windows CRLF endings, which strict downstream parsers can reject. JSON.parse is tolerant of any whitespace between tokens including carriage returns, so the FixTools formatter handles this correctly. If you also need to feed the response into a stricter consumer such as a database COPY command or a strict canonical hash, run the response through a normalisation step that strips carriage returns. dos2unix is the classic Unix tool for this conversion, and PowerShell has an equivalent through [System.IO.File]::ReadAllText followed by .Replace.
When the API itself returns an error, the response body is sometimes JSON describing the error and sometimes a plain text or HTML message. Format what arrives, even if it looks unexpected: a formatted JSON error response usually reveals a structured error code and message that maps to API documentation, and a non-JSON response that fails to parse points to a different layer of failure such as an HTTP gateway returning a generic 502 page. The shape of the failure narrows the debugging surface quickly. Always include curl --include to capture the HTTP status alongside the body when you suspect an error, because the status code is the single fastest way to distinguish a parsing problem from an API-level rejection.
How to use this tool
Paste a curl response body into the input area and click Format. The indented, syntax-highlighted JSON appears immediately with a copy button.
How It Works
Step-by-step guide to format json from curl output:
- 1
Run curl with a clean output flag
Run your curl command with --silent --show-error so the output contains only the response body and any error messages, without the default progress meter that would otherwise contaminate the output. For example: curl --silent --show-error https://api.example.com/users/42. The output is the raw response body, ready for formatting.
- 2
Copy the response body
Select the response body in your terminal and copy it to the clipboard. On macOS terminals this is Cmd-C, on Linux terminals it is typically Ctrl-Shift-C, and on Windows it depends on the terminal emulator. If the response is large, redirect curl output to a file with curl ... > response.json, then open the file in any text editor and copy from there.
- 3
Paste into FixTools
Paste the copied response body into the FixTools formatter input area. The tool accepts any raw JSON regardless of trailing whitespace, line ending style, or accidentally included shell prompts at the start. If the body parses cleanly the formatted output appears immediately on the right side of the page.
- 4
Read and copy
Scan the formatted JSON to verify the response shape and the values of the fields you care about. Use Ctrl-F or Cmd-F in the browser to search for specific keys or values within the formatted output. Copy the formatted version with the copy button if you need it for a bug report, a documentation example, or a pull request comment.
Real-world examples
Common situations where this approach makes a real difference:
API integrator
Inspecting raw API responses with curl plus a browser formatter is often faster than reading the official documentation for shape information.
Site reliability engineer
Formatted error responses reveal stack traces and structured error codes far more quickly than reading them as single-line text.
Documentation author
Real API responses formatted with a consistent style make documentation samples stay accurate to what users will actually see.
GraphQL developer
GraphQL responses always wrap data and errors in a known envelope, which formats cleanly and exposes resolver errors immediately.
Pro tips
Get better results with these expert suggestions:
Always use curl --silent for clean output
curl prints a progress meter to standard error by default, and when you redirect both streams to a file or another process the meter can interleave with the response body. The --silent flag suppresses the meter entirely, and --silent --show-error keeps actual network errors visible while suppressing progress noise. This combination produces clean response bodies suitable for direct paste into a formatter without any post-processing.
Combine with jq for filtered formatting
When the curl response is large but you only need a specific subtree, pipe through jq before pasting: curl --silent https://api.example.com/users | jq .data.users[0]. The jq output is a single record in pretty printed form, which is easier to inspect than the full response and avoids overwhelming the formatter with thousands of items. Use the FixTools formatter for the final scan and copy operation.
Use --include to capture status with body
When investigating an API error, run curl --include to print the HTTP status line and headers above the response body. The status code is the fastest way to distinguish a parsing problem from an API-level rejection, and the headers may include retry hints or rate limit information. Strip the header block before pasting into the formatter, or paste the full output and the parser will fail at the first non-JSON character, pinpointing where the body actually starts.
Save large responses to a file first
For response bodies larger than a few hundred kilobytes, redirect the output to a file with curl --silent --output response.json instead of trying to copy from a terminal scrollback. Open the file in any text editor, copy the contents, and paste into FixTools. This avoids terminal line-wrapping artefacts that can creep in when you copy long lines from some terminal emulators and produces a clean input for the formatter.
Frequently asked questions
Related guides
More use-case guides for the same tool:
Related tools
Other tools you might find useful:
Ready to get started?
Open JSON Formatter to review its free limits and processing method.
Open JSON Formatter →Free tier · No account needed · Transparent limits