如何从[对象,对象] JS获取数据

发布于 2025-02-13 08:14:09 字数 435 浏览 1 评论 0原文

我试图编码数据(使用btoa())将其发送到数据库,然后在检索并解码时,我无法访问内容 我只是得到[对象,对象]的数组

data = [object Object],[object Object],[object Object],....

output of : JSON.parse(data) =  [object Object]
output of : JSON.parse(JSON.stringify(data)) = "[object,Object]"
output of : data[0] = [ 
output of : actual.hasOwnProperty("key") = false 
i tried : x = `[${data}]` same problem it only read the data object as a string 

I am trying to encode data(using btoa() ) send it to a data-base then when i retrieve it and decode it i am unable to access the content
i just get an array of [object , Object ]

data = [object Object],[object Object],[object Object],....

output of : JSON.parse(data) =  [object Object]
output of : JSON.parse(JSON.stringify(data)) = "[object,Object]"
output of : data[0] = [ 
output of : actual.hasOwnProperty("key") = false 
i tried : x = `[${data}]` same problem it only read the data object as a string 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青春有你 2025-02-20 08:14:09

所以实际上我正在编码JS对象
添加:data = json.stringify(data).toString();
解决了问题

so actually i was encoding a js object
adding :data = JSON.stringify(data).toString();
solved the problem

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文