API response formatter — JSON and XML pretty-print, validate, and tree view

This free API response formatter online helps you work with REST and GraphQL JSON payloads and SOAP or XML-RPC style XML in one place. Paste a raw body from HTTP clients, webhook deliveries, or integration logs to pretty-print API responses, run a quick JSON or XML syntax check, and open a collapsible tree viewer for nested objects and elements. Processing stays in the browser—ideal when you debug staging tokens, compare vendor payloads, or document example responses next to our HTTP request builder and the dedicated JSON formatter or XML formatter when you need format-specific workflows.

FormatDetected: JSON

Valid JSON — format to indent, or explore the tree below.

JSON tree

  • "status": 200
  • "data":
}

Why use a dedicated API response formatter?

Modern integrations return large nested graphs: pagination wrappers, error envelopes, and vendor-specific extensions. A focused REST API response viewer turns opaque blobs into structured views so you can confirm field names, array cardinality, and null handling before you update SDKs or ETL jobs. When your stack still serves XML—legacy enterprise APIs, SAML metadata, RSS-like feeds—the same page behaves as an XML response formatter with a strict parser so malformed markup surfaces immediately instead of failing downstream.

Security-minded teams prefer client-side formatting for payloads that may contain PII, session identifiers, or signed assertions. Because nothing is uploaded, you can safely inspect redacted samples from production-like environments while pairing with our JWT decoder when tokens appear inside JSON bodies.

How to use this formatter (step by step)

  1. Pick Auto unless you need to force JSON or XML (for example when debugging Content-Type mismatches). Auto treats inputs that start with “<” as XML and otherwise prefers JSON when it parses cleanly.
  2. Paste the response body into the textarea, or use Upload file for saved exports. Avoid pasting secrets into shared machines; copy only what you need for structure review.
  3. Click Format & validate to rewrite with two-space indentation when the payload is valid. Errors call out JSON positions or the browser’s XML parser message so you can fix commas, entities, or tags.
  4. Use Minify for compact lines suitable for queues, archived HAR snippets, or attachment to tickets. Copy grabs the current editor text after any transform.
  5. Expand the JSON tree or XML element tree to walk nested structures. Use Expand all for a full outline, or Collapse to root to reset.

JSON vs XML in real API workflows

JSON dominates public REST and GraphQL transports: strict parsing, predictable types, and easy mapping to JavaScript and mobile clients. XML remains common in regulated industries, SOAP services, and document-style payloads with mixed content. Carrying both parsers behind one API debugging tool reduces tab churn when you switch between partners or versions. When you only need XML depth editing, the standalone XML formatter offers paired input/output panes; when you only need JSON, the JSON formatter page stays a fast default.

Webhooks, retries, and SEO-adjacent payloads

Operations teams often inspect webhook JSON bodies after signature verification to confirm idempotency keys and event types. Formatting here makes diffing retry deliveries easier before you route data to BI or CRM systems. Content and growth engineers sometimes extract fragments destined for JSON-LD or headless CMS sync—validate those snippets here, then validate live URLs with our meta tags extractor or schema markup generator when you publish structured data.

Related API and developer tools

Browse the full API developer toolbox for request builders, OpenAPI viewers, and HTTP references. Highlights:

  • HTTP Request BuilderTest, document, and debug APIs without leaving the browser—pick method, headers, and body, then send with fetch.
  • OpenAPI / Swagger ViewerPaste OpenAPI in YAML or JSON and browse interactive docs—paths, schemas, and examples in one place.
  • Webhook Payload TesterPractice webhook debugging client-side: log sample POST bodies locally (e.g. localStorage) when a public capture URL is not available.
  • HTTP Status Code ReferenceSearch HTTP status codes with plain-English meanings, typical causes, and what to do next.
  • MIME Type LookupMap filenames or extensions to MIME types for Content-Type headers, uploads, and API contracts.
  • OAuth 2.0 Flow VisualizerWalk through the authorization code flow step by step with interactive fields and diagrams.
  • API Rate Limit CalculatorGiven X requests per minute and a daily budget of Y calls, see pacing and when you hit the wall.

Frequently asked questions

What is an API response formatter used for?
It helps you inspect payloads returned by REST, GraphQL, SOAP, and webhook endpoints. Paste raw JSON or XML from curl, browser devtools, or log files to pretty-print, validate structure, and browse nested data in a collapsible tree—without uploading your response to a server.
Does this tool send my API responses to your backend?
No. Parsing, formatting, and the tree view run entirely in your browser with JavaScript. Data stays on your machine unless you copy it elsewhere yourself.
How do I know whether my paste is JSON or XML?
Leave the mode on Auto: responses that start with “<” are treated as XML (including declarations like <?xml). Responses that start with “{” or “[” are parsed as JSON. If JSON parsing fails, the tool tries XML so you can recover from minor framing issues.
Why does valid-looking text fail as JSON?
JSON requires double-quoted keys and strings, no trailing commas, and no comments. Single quotes, trailing commas, or JavaScript-only values like undefined will cause JSON.parse to fail—fix the source or use a dedicated JSON formatter to spot the exact position.
Why does my XML fail to parse?
Browsers use a strict XML parser: unclosed tags, mismatched namespaces, illegal characters in text nodes, or multiple root elements will error. Check the parser message, validate against your schema offline, and ensure entities like & are written as &amp; inside elements.
Can I minify responses for storage or logs?
Yes. Use Minify to remove whitespace from JSON or XML after a successful parse. Minified output is smaller for archives and queues; use pretty-print when you need readable diffs or screenshots.
How is this different from a JSON-only formatter?
This page targets mixed API workflows: the same textarea accepts JSON and XML, which matters when you switch between REST/JSON and SOAP/XML services or inspect webhooks that may send either. For deep JSON-only editing you can also use the standalone JSON formatter linked from this page.
Which related tools pair with this formatter?
Use the HTTP request builder to reproduce calls, the JWT decoder for bearer tokens inside JSON payloads, the XML formatter for XSD-heavy editing, and the JSON formatter when you only work with JavaScript object notation—each is linked from the guides below.