我在jquery中有这样的数据如何从group1,user2等组列表中获取groupname2值:
{"groupslist":{"groupname":["user1","user2","user3"],"groupname2":["user1","user2","user3"],"groupname3":["user1","user2","user3"]}}
我已声明grouplist={}
并动态推送groupname值,当我打印grouplist为`
Object {user00: Array[3], super user: Array[1], supreme user: Array[0]}
super user: Array[1]
0: "sample_vh.com"
length: 1
__proto__: Array[0]
supreme user: Array[0]
user00: Array[3]
0: "veera_tls.com"
1: "v_v.com"
2: "sample_vh.com"
length: 3
__proto__: Array[0]
__proto__: Object`
答案 0 :(得分:3)
var o = {
"groupslist":{
"groupname":["user1","user2","user3"],
"groupname2":["user1","user2","user3"],
"groupname3":["user1","user2","user3"]
}
};
console.log(o.groupslist.groupname2);
答案 1 :(得分:0)
您的数据可以像这样访问:
var mylist = {"groupslist":{"groupname":["user1","user2","user3"],"groupname2":["user1","user2","user3"],"groupname3":["user1","user2","user3"]}};
console.log(mylist.groupslist.groupname2)