admin管理员组文章数量:1431037
The above is the returned object from firebase and I do this:
JSON.stringify(data) // where data is the returned object
Then I get the error: TypeError: Converting circular structure to JSON
How to properly handle an object response like that from firebase?
This answer paints a picture of what is happening, however, in the case of firebase, how to go about it?
The above is the returned object from firebase and I do this:
JSON.stringify(data) // where data is the returned object
Then I get the error: TypeError: Converting circular structure to JSON
How to properly handle an object response like that from firebase?
This answer paints a picture of what is happening, however, in the case of firebase, how to go about it?
Share Improve this question edited May 23, 2017 at 10:30 CommunityBot 11 silver badge asked Nov 19, 2016 at 12:55 KhoPhiKhoPhi 9,55718 gold badges85 silver badges139 bronze badges2 Answers
Reset to default 4You have to call the val()
method...
JSON.stringify(data.val())
The proper way to handle the error "TypeError: Converting circular struct to JSON" when getting data from Firebase is to enumerate the key/value pairs explicitly and examine them:
Object.keys(data).forEach((key) => {
let value = data[key];
console.log(key + " : " + value);
});
The data you have is almost certainly not the data you think you have.
本文标签: javascriptConverting circular structure to JSON FirebaseStack Overflow
版权声明:本文标题:javascript - Converting circular structure to JSON Firebase - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745499455a2660961.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论