我正在尝试创建服务器和应用程序(客户端)之间的双向通信。
Stringified response.text()返回这个...有没有办法让它只返回文本?我做错了什么?

发布于 2017-05-08 00:15:12
您的要求不明确。你面临的问题是什么?服务器响应将始终为字符串。它可以是有效的Json/xml或纯文本。如果您想将其用作JSON。
来源:https://facebook.github.io/react-native/docs/network.html
function getMoviesFromApiAsync() {
return fetch('https://facebook.github.io/react-native/movies.json')
.then((response) => response.json())
.then((responseJson) => {
return responseJson.movies;
})
.catch((error) => {
console.error(error);
});
}发布于 2017-05-08 06:04:12
用substring()和indexOf()修复了这个问题。
https://stackoverflow.com/questions/43833474
复制相似问题