[未处理的承诺拒绝:语法错误:JSON解析错误:无法识别的令牌“”]

[未处理的承诺拒绝:语法错误:JSON解析错误:无法识别的令牌“”],json,reactjs,react-native,expo,Json,Reactjs,React Native,Expo,我只想在react native error中映射一个JSON数据,但我得到的错误是[Unhandled promise rejection:SyntaxError:JSON Parse error:Unrecogned token''] 在使用JSON.parse解析它之后 axios.get("http://www.upclass.com.hk/api.php?apicall=getcustomer").then((e) => { va

我只想在react native error中映射一个JSON数据,但我得到的错误是[Unhandled promise rejection:SyntaxError:JSON Parse error:Unrecogned token''] 在使用JSON.parse解析它之后

    axios.get("http://www.upclass.com.hk/api.php?apicall=getcustomer").then((e) => {
          var res = JSON.parse(e.data)
          console.log("New Data =>", res);
          this.setState({
                data: res
                });
    });
这是JSON数据

{
"id": "D6C9C876-CDA2-4C27-85BF-276D3035D762",
"fullname": null,
"username": null,
"email": "mohssssin@gmail.com",
"areaid": null,
"aid": null,
"mobile": "123456",
"photoid": null,
"imagepath": null,
"lang": "zh",
"custgroup": "P         ",
"IsVolunteer": null,
"notification": "Y",
"createdate": "2021-03-26 19:05:02.290",
"updatedate": null,
"otherarea": null
}

尝试JsonConvert.DeserializeObject而不是Parse。

请参见e.data已经是一个对象。您不需要用JSON解析它。parse@derpirscher,但我无法使用此.state.data映射它。id@SuhailKakar-然后在实现处理程序的第一行上放置一个断点,并查看调试器中的e.data,看看您得到了什么。@T.J.Crowder,在《邮递员》中,这很好,即使我使用浏览器,我也能获得正确的数据,但当我添加到代码中时,我得到了一个?在responseQuite的开头,使用像NewtonSoft.Json这样的.NET库在javascript中不太可能起作用。。。