2016-07-06 15 views
0
{"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":[]} 

を使用して、このハッシュにアクセスすることができます。これは、一般的なjavascriptの質問であるハッシュどのように私は、角2

+0

ハッシュとはどういう意味ですか?このjsonをコンポーネントにしますか? –

+0

'console.log(ハッシュ['groupsPostRights'])'単純に。 –

答えて

0

「groupsPostRights」を取得するために私を助けてください。 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; 
関連する問題