Skip to content
1 articles

#fetch

1 technical articles tagged with fetch

Advertisement
API2026-09-08

Unexpected token '<' is not valid JSON — 5 Reasons Your API Returned HTML Instead

fetch throws SyntaxError: Unexpected token '<' when the response body is HTML, not JSON. Covers the 5 root causes: SPA history fallback returning index.html, auth 302 redirects, gateway 502 error pages, wrong baseURL, and missing res.ok checks — with curl diagnostics.

Read more
Advertisement