All guides
Workflow guide

How to Validate a JSON API Response

API responses are easiest to debug when they are valid JSON, readable, and stripped of data that should not leave your machine. This workflow keeps validation local.

Updated 2026-05-25

Use the related tools

Topic cluster

Sensitive Data Tools

Browser-local workflows for JSON, JWTs, PDFs, images, hashes, and other data you hesitate to paste online.

Open hub

Related guides

Validation workflow

Paste the response into a local JSON formatter, confirm it parses, inspect nested objects, and only then copy the minimum safe subset into docs, fixtures, or tickets.

  • Confirm the payload is valid standard JSON.
  • Check for trailing commas, comments, and single-quoted strings.
  • Review nested fields for secrets, customer data, and internal IDs.
  • Use minification only after the payload is correct and safe to share.

When the response is not JSON

A failed parse can mean the API returned HTML, plain text, an empty response, or a different content type. Check status and response headers if the body is unexpected.

Before saving as a fixture

Redact live identifiers, timestamps, emails, tokens, and tenant values before committing a response into tests or examples.

FAQ

Does valid JSON mean the API response is correct?

No. Syntax validity only proves the response can be parsed as JSON. You still need schema, business, and security checks.

Why did an API response fail JSON validation?

Common causes include HTML error pages, trailing commas, comments, single quotes, invalid escapes, or a response body that is not JSON.