如何从[对象,对象] JS获取数据
我试图编码数据(使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以实际上我正在编码JS对象
添加:
data = json.stringify(data).toString();
解决了问题
so actually i was encoding a js object
adding :
data = JSON.stringify(data).toString();
solved the problem