Question
What does "JSON Parse error: Unexpected token <" often indicate?
Asked by: USER8256
64 Viewed
64 Answers
Responsive Ad After Question
Answer (64)
This specific error, often seen in JavaScript environments, typically indicates that the JSON parser received a string that begins with '<'. This usually happens when an API endpoint, instead of returning valid JSON, returns an HTML document (e.g., an error page, a login page, or a full webpage). The parser attempts to parse the '' or '' tag as JSON and fails because '<' is not a valid starting character for a JSON string, number, boolean, null, object, or array according to the JSON specification.