NodeJS fetch 返回的数据多于应有的数据,这不是我的 Flask 服务器发送的数据

NodeJS fetch is returning more data than it should, and it's not the data my Flask server is sending it

我是 运行 我的 React Native 应用程序中的一个 NodeJS fetch(),用于从我的 Flask Heroku 服务器获取数据

这是 Flask 服务器所做的:

(我确定 returns 这通常是因为当我在浏览器中转到 URL 时,它是一个带有“false”字样的空白页面

@app.route('/login')
def login():
    
    #some code that I'm sure is working and doesn't need to be shown
    
    return jsonify(False)

这是 React Native 应用执行的代码:

console.log(address)

var returned = await fetch(address)

console.log(JSON.stringify(returned))

我知道它正在使用的地址,因为我正在将它打印到控制台。我已经转到这个 URL,从我的控制台复制粘贴到浏览器中,返回的数据看起来很好

这是 React Native 的 fetch() returns:

{"type":"default","status":200,"ok":true,"headers":{"map":{"content-length":"6","connection":"keep-alive","content-type":"application/json","date":"Wed, 26 Aug 2020 17:46:31 GMT","via":"1.1 vegur","server":"gunicorn/20.0.4","cache-control":"public, max-age=0"}},"url":"[MY_URL_IS_HERE]/login?username=W&tag=L","bodyUsed":false,"_bodyInit":{"_data":{"size":6,"offset":0,"blobId":"e450e243-9a7e-4a35-8e47-f8e9f3c7a58c","__collector":{}}},"_bodyBlob":{"_data":{"size":6,"offset":0,"blobId":"e450e243-9a7e-4a35-8e47-f8e9f3c7a58c","__collector":{}}}}

我看过许多在线指南和 Whosebug 帖子,但其中 none 帮助了我 parse/get 比这更好的数据。

如何获取我的数据?

@AyushGupta 指出我需要改变:

var returned = await fetch(address)

至:

var returned = (await (await fetch(address)).json())