About API Response Formatter

Paste a raw API response and the tool auto-detects whether it’s JSON, XML, or HTML, then pretty-prints it with proper indentation. JSON goes through JSON.parse and JSON.stringify with two-space indentation. XML is validated via DOMParser and checked for parser errors. The tool also extracts metadata—status codes, response time, payload size, and structure analysis showing array lengths and object property counts.

  • Auto-detects format by inspecting Content-Type headers first, then falls back to content inspection (looks for opening braces, angle brackets, or DOCTYPE)
  • JSON formatting uses native JSON.parse for validation followed by JSON.stringify with 2-space indentation
  • XML validation runs through DOMParser and checks for parsererror elements in the result
  • Structure analysis reports array lengths and object property counts at the top level
  • Four sample responses included: REST API, GraphQL, error response, and XML—useful for testing downstream tooling

Frequently Asked Questions

Can it format broken JSON?
No. If JSON.parse throws, the tool reports the error with position information. It doesn’t attempt to fix trailing commas, missing quotes, or single-quoted strings. Fix the syntax first, then format.
Does it handle GraphQL responses?
GraphQL responses are just JSON with a specific structure (data/errors keys). The formatter handles them the same as any JSON—it doesn’t do anything GraphQL-specific, but the sample response tab includes a GraphQL example.

More Utilities Tools

All Utilities tools