Home/Guides/API response invalid JSON fix

API response invalid JSON fix

When servers return HTML error pages or truncated JSON, clients throw on parse. Always check Content-Type and validate a substring before mapping models.

Common causes

  • Reverse proxy injects HTML.
  • Double-encoded JSON string.
  • Truncated chunked response.

How to fix

  • Run API Response Analyzer on the URL.
  • Use Request Body Validator on extracted JSON.
  • Fail closed when body is not application/json.