Common versions of the error
Unexpected token '<', "<!DOCTYPE "... is not valid JSON(older:Unexpected token < in JSON at position 0): the server returned HTML, often an error page or login redirect, instead of JSON"[object Object]" is not valid JSON(older:Unexpected token o in JSON at position 1): you passed an object, not a string, toJSON.parseExpected ',' or '}' after property value in JSON at position 42: a missing comma between two propertiesExpected double-quoted property name in JSON at position 57(older:Unexpected token }): usually a trailing comma right before the braceExpected property name or '}'/Unexpected token ''': single quotes or unquoted keysUnexpected end of JSON input: the text is empty or cut off, for example a missing closing bracket
How to read “position”
The position is a zero-based character offset into the string, which is hard to find by hand in a long document. Validate converts it to a line and column, shows the surrounding text with a marker, and the Jump to error button moves your cursor there.
When the problem is not the JSON
If the error mentions < or <!DOCTYPE, the fix is on the server or in the request URL, not in the JSON: open the response in your browser's network tab to see what was actually returned. If it mentions [object Object], remove the extra JSON.parse call, because your data is already an object.
Frequently asked questions
What does 'Unexpected token < in JSON at position 0' mean?
The very first character is wrong: the response is HTML (starting with <, usually <!DOCTYPE html>) rather than JSON. Newer browsers word this as Unexpected token '<', "<!DOCTYPE "... is not valid JSON. Check the request URL and what the server actually returned.
What causes 'Unexpected end of JSON input'?
The input ended before the JSON was complete: an empty string, a truncated download, or a missing closing } or ]. Quick Fix can add missing closing brackets.
How do I find the position in my file?
Paste the JSON and press Validate. It reports the line and column of the error and highlights the text around it.