Core Flow
- Capture raw response text before parsing.
- Validate with JSON Validator.
- Normalize using JSON Formatter.
- Compare payload variants via JSON Diff.
High-Impact Checks
- Content-Type mismatch (HTML returned instead of JSON).
- Unexpected token from escaped payload strings.
- Type mismatch between expected interfaces and runtime data.
Minimal Debug Snippet
const text = await response.text();
console.log(text.slice(0, 200));
const data = JSON.parse(text);Typed Workflows
For typed outputs, convert to TypeScript definitions and lock interface expectations before updating downstream code.
FAQ
Why does response.json() throw in production?
Most commonly due to auth redirects or CDN error pages returning HTML instead of JSON.
How do I handle double-encoded JSON?
Decode using String to JSON, then parse the result.