“SyntaxError: Unexpected token < in JSON at position 0”

前端 未结 30 2128
花落未央
花落未央 2020-11-22 04:39

In a React app component which handles Facebook-like content feeds, I am running into an error:

Feed.js:94 undefined \"parsererror\" \"SyntaxError: Un

30条回答
  •  我在风中等你
    2020-11-22 05:25

    I experienced this error "SyntaxError: Unexpected token m in JSON at position", where the token 'm' can be any other characters.

    It turned out that I missed one of the double quotes in the JSON object when I was using RESTconsole for DB test, as {"name: "math"}, the correct one should be {"name": "math"}

    It took me a lot effort to figure out this clumsy mistake. I am afraid others would run into similar bummers.

提交回复
热议问题