{"id":"20902a99-fa74-4ac7-97b5-1c50d59f536b",
"name":"User 1 Staff Lopperne",
"groupsPostRights":{
"0":{"id":"04b01fac-a285-4596-b78b-2f64e703678e","institutionId":"7c7b10d5-68fb-4768-8c5a-fdf3573460c4"
,"name":"Alle","subtitle":null,"parentId":null,"type":"main"},
"1":{"id":"7f8541c9-dbe3-495d-ba02-e73e4e74e7f4","institutionId":"7c7b10d5-68fb-4768-8c5a-fdf3573460c4","name":"Personale","subtitle":null,"parentId":null,"type":"staff"},
"3":{"id":"b07ef269-df60-4f58-b66e-248c12f9c8ac","institutionId":"7c7b10d5-68fb-4768-8c5a-fdf3573460c4"
,"name":"Lopperne (Personale)","subtitle":null,"parentId":"053c8681-70b3-40f9-9a7b-a946028ef7b8","type"
:"staff"},
"4":{"id":"d5368df8-d981-4030-b217-1415e87ccabe","institutionId":"7c7b10d5-68fb-4768-8c5a-fdf3573460c4"
,"name":"Lopperne (For\u00e6ldre)","subtitle":null,"parentId":"053c8681-70b3-40f9-9a7b-a946028ef7b8"
,"type":"parents"}},
"isManagerAt":[]}
请帮我在哈希
中获取" groupsPostRights"答案 0 :(得分:0)
这是一般的javascript问题。您只需解析JSON字符串。
var json = '{"id":"20902a99-fa74-4ac7-97b5-1c50d59f536b", "name":"User 1 Staff Lopperne", "groupsPostRights":{ "0":{"id":"04b01fac-a285-4596-b78b-2f64e703678e","institutionId":"7c7b10d5-68fb-4768-8c5a-fdf3573460c4" ,"name":"Alle","subtitle":null,"parentId":null,"type":"main"}, "1":{"id":"7f8541c9-dbe3-495d-ba02-e73e4e74e7f4","institutionId":"7c7b10d5-68fb-4768-8c5a-fdf3573460c4","name":"Personale","subtitle":null,"parentId":null,"type":"staff"}, "3":{"id":"b07ef269-df60-4f58-b66e-248c12f9c8ac","institutionId":"7c7b10d5-68fb-4768-8c5a-fdf3573460c4" ,"name":"Lopperne (Personale)","subtitle":null,"parentId":"053c8681-70b3-40f9-9a7b-a946028ef7b8","type" :"staff"}, "4":{"id":"d5368df8-d981-4030-b217-1415e87ccabe","institutionId":"7c7b10d5-68fb-4768-8c5a-fdf3573460c4" ,"name":"Lopperne (For\u00e6ldre)","subtitle":null,"parentId":"053c8681-70b3-40f9-9a7b-a946028ef7b8" ,"type":"parents"}}, "isManagerAt":[]}';
var obj = JSON.parse(json);
var rights = obj.groupsPostRights;