Free · Fast · Privacy-first

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 in your browser
Formatted JSON
Run the tool to see a task-specific result.
⚡

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
IframeResponsiveAttribution included

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. 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. 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. 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. 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:

1

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.

2

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.

3

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.

4

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.

FAQ

Frequently asked questions

Run curl with the --silent and --show-error flags so the output contains only the response body and any actual network errors, without the default progress meter that contaminates the output otherwise. The full command pattern is curl --silent --show-error https://api.example.com/endpoint. The output is then the raw response body, which you can copy directly into the FixTools formatter for a beautified, syntax-highlighted view of the JSON content.
curl prints a progress meter to standard error by default, and when both streams are redirected together (for example with 2>&1) the meter interleaves with the response body. Use --silent to suppress the meter entirely, or --silent --show-error to keep error messages visible while suppressing progress. If you have already captured contaminated output, strip the meter lines manually before pasting into the formatter; the easiest pattern is to look for the response body delimiter and copy from that point forward.
Yes. FixTools handles JSON documents up to several tens of megabytes with no noticeable delay. For very large curl responses, redirect the output to a file first with curl --silent --output response.json, then open the file in a text editor, select all, copy, and paste into the formatter. This avoids any terminal line-wrapping or scrollback issues that can corrupt very long lines copied directly from the terminal window of some emulators. For responses over 100MB, prefer jq at the command line over a browser-based formatter.
Use the -H or --header flag once per header. For example, curl --silent --show-error -H "Authorization: Bearer TOKEN" -H "Accept: application/json" https://api.example.com/endpoint adds authentication and a content negotiation header. The Accept header tells servers that support content negotiation to return JSON rather than HTML or XML, which avoids the common failure mode where the API returns an HTML error page that confuses a JSON-only formatter. Always include Accept: application/json when fetching JSON.
curl follows redirects only when you pass the -L or --location flag explicitly. Without it, a 301 or 302 response produces an empty body and a Location header pointing to the new URL. Re-run with curl --silent --show-error -L https://api.example.com/endpoint to follow the redirect and capture the final response body. This is especially important for APIs that redirect HTTP to HTTPS, or that redirect a versionless path to a specific version path.
Use the -d or --data flag with the JSON content. For inline JSON, use single quotes around the body: curl --silent --show-error -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://api.example.com/endpoint. For larger bodies, save the JSON to a file and reference it with the @ prefix: curl ... -d @body.json. The Content-Type header is required for most servers to parse the body as JSON; without it, many servers default to form-encoded interpretation and reject the input.
The most common causes are: the response is actually an HTML error page (check the HTTP status with curl --include), the response includes a UTF-8 byte order mark (FixTools handles this but strict parsers may not), the response was truncated due to network issues (re-run with --max-time set higher), or the response body was contaminated with curl progress meter output (re-run with --silent). The formatter reports the exact line and column of the first parse error, which usually pinpoints the source of the problem within seconds of reviewing the input.

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

Source-backed reference

JSON standards quick reference

Concise, standards-backed facts for developers working with JSON debugging and validation. Each claim is linked to the evidence registry and resolves to a primary standard or platform reference so it can be independently verified.

JSON standard
JSON is a text format for serializing structured data, with syntax defined by interoperable standards rather than by FixTools.
Strings and object keys
JSON strings and object member names use double quotation marks. Single-quoted strings are not valid standard JSON syntax.
Trailing commas
Standard JSON grammar does not allow a comma after the final member of an object or the final element of an array.
Parser behavior
JSON.parse() parses JSON text into a JavaScript value and raises a SyntaxError when the input is not valid JSON.

Common invalid → valid JSON examples

Trailing comma

{"a":1,}{"a":1}

Single-quoted key

{'a':1}{"a":1}

Unsupported literal

{"score":NaN}{"score":null}

Built for verification, not just extraction

Direct answers are paired with source-specific evidence. This keeps technical claims independently verifiable and gives search and answer systems a clearer provenance trail than unsupported summary copy.