Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/17.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
Json 无法通过我的GET响应接收数据_Json_React Native_Get_Arangodb - Fatal编程技术网

Json 无法通过我的GET响应接收数据

Json 无法通过我的GET响应接收数据,json,react-native,get,arangodb,Json,React Native,Get,Arangodb,我正在将数据从数据库发送到React本机应用程序,但当我收到GET请求的响应时,我无法从响应中获取数据 我尝试了JSON.stringify、JSON.parse、输入response[0]、response.name(我的响应中的一个对象)等 我的回复主体有4个对象,_key、name、email和school。我希望能够从我的响应中查看并保存所有这些对象。如果您正在使用fetch和CALL: fetch('http://yourdomain.com', {method: 'GET',})

我正在将数据从数据库发送到React本机应用程序,但当我收到GET请求的响应时,我无法从响应中获取数据

我尝试了
JSON.stringify
JSON.parse
、输入response[0]、response.name(我的响应中的一个对象)等


我的回复主体有4个对象,_key、name、email和school。我希望能够从我的响应中查看并保存所有这些对象。

如果您正在使用fetch和CALL:

fetch('http://yourdomain.com', {method: 'GET',})
.then(response => {alert(JSON.stringify(response));)
然后需要调用第二个
。然后()
以获取响应的主体:

fetch('http://yourdomain.com', {method: 'GET',})
.then(response => {response.json()})
.then(data => {alert(data)})
.catch(error => console.log(error))

如果您正在使用获取和调用:

fetch('http://yourdomain.com', {method: 'GET',})
.then(response => {alert(JSON.stringify(response));)
然后需要调用第二个
。然后()
以获取响应的主体:

fetch('http://yourdomain.com', {method: 'GET',})
.then(response => {response.json()})
.then(data => {alert(data)})
.catch(error => console.log(error))

请张贴您的相关代码,以便我们可以帮助您。不幸的是,目前您的帖子中没有足够的信息。请发布您的相关代码,以便我们能够帮助您。不幸的是,现在你的帖子上没有足够的信息。