Format API response

Format a captured JSON API response with readable body, keys, and metadata.

freeworks offlinenothing uploaded
ToolAPI Response Formatter
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

A response body is parsed as JSON, then reserialized with indentation, sorted keys, or compact separators while status, headers, and body remain separate. Invalid JSON is reported rather than silently repaired.

  • Two-space output suits debugging.
  • Compact mode mirrors transport serialization.

Worked example

Format JSON API Response
Pretty-print a minified JSON API response with 2-space indentation
Input
											{"id":1,"name":"Alice","email":"[email protected]","roles":["admin","user"]}
										
Output
												{
  "id": 1,
  "name": "Alice",
  "email": "[email protected]",
  "roles": [
    "admin",
    "user"
  ]
}
											

When to use this

Support captures, API snapshots, and documentation examples format responses.

Edge cases

  • Large numbers can lose precision during JavaScript parsing.
  • Duplicate JSON keys are ambiguous.
  • A 204 response can have an empty body rather than JSON.

References