Json 无法通过我的GET响应接收数据
我正在将数据从数据库发送到React本机应用程序,但当我收到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',})
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))
请张贴您的相关代码,以便我们可以帮助您。不幸的是,目前您的帖子中没有足够的信息。请发布您的相关代码,以便我们能够帮助您。不幸的是,现在你的帖子上没有足够的信息。