Quick answer

Many APIs return JSON.

API Response Invalid JSON

Many APIs return JSON. If the response body is not valid JSON (e.g. truncated, malformed, or HTML error page), parsers will fail. Use a checker to get the exact line and column.

Common causes

How to fix

Examples

Bad

{"id": 1, "name": "test",}

Good

{"id": 1, "name": "test"}

FAQ

Why is my API response not valid JSON?
Often the server returned HTML (error page), or the body was truncated. Validate the raw body to see the exact error.
Can I paste a full HTTP response?
Yes. The checker extracts the body after the blank line and validates the JSON part.

Fix it now

Try in validator (prefill this example)

Related

All tools · Canonical