Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 1未捕获(承诺中)语法错误:意外标记。在位置4处使用JSON_C#_Reactjs - Fatal编程技术网

C# 1未捕获(承诺中)语法错误:意外标记。在位置4处使用JSON

C# 1未捕获(承诺中)语法错误:意外标记。在位置4处使用JSON,c#,reactjs,C#,Reactjs,当我调用运行控制台应用程序的api时,我的react应用程序中出现了这个错误,该应用程序创建了一个包含信息的.json。它返回此输出“80.0.3987.132”,但似乎有解析错误。以下是引发错误的api调用: fetch("api/Version/Installed") .then(res => res.json() as Promise<Version[]>) .then(data => { this.setState({ version: data

当我调用运行控制台应用程序的api时,我的react应用程序中出现了这个错误,该应用程序创建了一个包含信息的.json。它返回此输出“80.0.3987.132”,但似乎有解析错误。以下是引发错误的api调用:

fetch("api/Version/Installed")
  .then(res => res.json() as Promise<Version[]>)
  .then(data => {
    this.setState({ version: data });
    console.log(this.state.version);
  });
console.log(this.state.version);
fetch(“api/版本/已安装”)
.then(res=>res.json()作为承诺)
。然后(数据=>{
this.setState({version:data});
console.log(this.state.version);
});
console.log(this.state.version);

“80.0.3987.132”不是有效的json。试试
res.text()
效果很好。谢谢