【发布时间】:2018-04-19 21:48:58
【问题描述】:
当我从服务器获取 Json 时,我只会在边缘遇到问题。 这是我的 json :
{"user":[{"pk":10,"user_group":[1,2,6],"uname":"5555678910","upass":"","first_name":"tutu","last_name":"","country":1,"other_countries":[],"brands":[]},{"pk":7,"user_group":[1,2],"uname":"aaa","upass":"","country":1,"other_countries":[5],"brands":[1]},{"pk":8,"user_group":[1],"uname":"222","upass":"","first_name":"","last_name":"","country":1,"other_countries":[],"brands":[]}]}
(您可以复制/粘贴到:http://json.parser.online.fr/)
而且只有在 Edge 上,我得到了这个 json:
{"user":[{"pk":10,"user_group":[1,2,6],"uname":"5555678910","upass":"","first_name":"tutu","last_name":"","country":1,"other_countries":[],"brands":[]},{"pk":7,"user_group":[1,2],"uname":"aaa","upass":"","country":1,"other_countries":[5],"braands":[1]},{"pk":8,"user_group":[1],"uname":"222","upass":"","first_name":"","last_name":"","country":1,"other_countries":[],"brands":[]}]}
“品牌”键给了我“品牌”,当我将键更改为“qwerty”时,我得到了“qweerty”。
只有第二个用户,其余的都有正确的密钥。
【问题讨论】:
-
我找不到任何密钥
qwerty并且我得到品牌就好了 -
不,当我将关键“品牌”的名称更改为“qwerty”时,我得到了“qweerty”
-
当我使用 jsonCallback.user[j].brands.length 时,我遇到如下错误:“无法获取未定义或空引用的属性‘长度’”,因为第二个对象有: jsonCallback.user[1].braands
标签: javascript jquery json key microsoft-edge