Skip to content

API Response Formatter

Paste a raw API response and pretty-print it with 2-space indent, key sorting, byte size, key count and parse-error line info.

What it does

You copied a response out of the network tab and it landed as one wall of text. Maybe 3KB on a single line, maybe a curl dump with no breaks. Paste it here and get clean, indented JSON back. The indentation is always 2 spaces, which keeps your output diffable against everyone else’s.

There’s a sort-keys toggle too. Flip it on and every object gets its keys alphabetized, top to bottom, all the way down the tree. That one switch is the difference between “these two responses look different” and “ah, the only real change is total: 128 versus total: 130.”

Minified and escaped both work

Plenty of APIs hand you JSON that’s already been JSON-encoded once. You get back something like "{\"token\":\"abc\",\"scope\":[\"read\"]}". Quotes everywhere, backslashes everywhere, unreadable. Paste that exact string and the formatter notices it’s a wrapped payload, unwraps it, and pretty-prints what’s inside. A little blue badge tells you it unwrapped an escaped string so you know what happened.

Regular minified JSON, the kind a production server gzips and ships without whitespace, formats the same way. No mode to pick. Just paste and it figures out which case you’ve got.

Reading the stats

Under the output you’ll see three small numbers, plus a fourth when relevant:

  • Keys counts every key across the whole structure, including nested objects and objects buried inside arrays. A flat config might show 8. A paginated user list can show 400+.
  • Size is the byte size of the formatted result, measured with an actual Blob, so multibyte characters (emoji, accented names, CJK text) count for their real weight instead of one byte each.
  • Indent confirms what you’re getting: 2 spaces, every time.
  • The unwrapped badge only appears when the input was a double-encoded string.

When the JSON is broken

Half the responses you paste while debugging aren’t valid. A trailing comma snuck in, a quote got eaten by the terminal, the payload got truncated at 4096 bytes. Instead of a vague “invalid” the tool shows the parser’s message and the line and column where it choked, then highlights that exact line in the input with a red wavy underline. Scroll to it, fix it, you’re done.

Errors aren’t always where they feel like they should be. A missing closing brace gets reported at the end of the file, because that’s where the parser finally gives up.

Privacy

Everything happens in your browser. The response you paste never touches a server, which matters because API payloads carry bearer tokens, session cookies, and personal data. Inspect a staging response with a live auth header in it and nothing leaves your machine. Copy the result, download it as response.json, or close the tab.

FAQ

Why is the indent locked to 2 spaces?

Stable output is the point. When everyone formats the same way, two responses diff cleanly and code review shows real changes instead of whitespace noise. 2 spaces is the JavaScript and JSON default, so it’s the safe pick.

Does sort keys change my data?

Nope. It only reorders keys for display. Values, arrays, and array order all stay exactly as they were. JSON object key order isn’t meaningful anyway, so sorting is purely cosmetic.

What does the key count actually count?

Every key in the tree. Top-level keys, nested object keys, and keys inside objects within arrays all add up. Array indexes aren’t keys, so a plain list of strings counts as zero.

My response is a JSON string inside a string. Will it format?

Yep. If the whole thing parses to a string that itself looks like JSON, it unwraps one layer and formats the inner payload. You’ll see an “unwrapped” badge confirming it.

Is there a size limit?

No upload cap since it runs locally. Responses in the low megabytes format in a blink. Something gigantic might pause your tab for a second while the browser does the parse.

Can I sort keys and copy the result?

Yes. Turn the toggle on, hit Copy or Download, and you get the alphabetized version. Toolsvu keeps the toggle state, so re-pasting reuses your current setting.

api json formatter response developer

Related Tools

More in Developer Tools