Uncaught SyntaxError: Unexpected token u
Do you see the following error in your console and wonder what's wrong?
Uncaught SyntaxError: Unexpected token
Most likely, this error occurs when the input given to the JSON.parse()
can not be converted to a valid JSON object. For example,
JSON.parse(undefined) // Uncaught SyntaxError: Unexpected token u(…)
JSON.parse('') // Uncaught SyntaxError: Unexpected end of input
JSON.parse('foo') // Uncaught SyntaxError: Unexpected token o(…)
Make sure the input to the JSON.parse
can be converted to the valid JSON object. I hope this helped resolving your problem.