-5
我有以下的JSON,我想提取唯一的位置,並把它放在另一個JSON或數組中與以前相同的格式。我是一個新手,因此,對我來說有點困惑。如何從Angular的JSON數據中提取特定的鍵?
這是我有:
let data = {
"Person" : [{"name":"harman","comment_count":255},
{"name":"aman","comment_count":66},
{"name":"mukesh","comment_count":66}],
"location": [{"name":"delhi","comment_count":255},
{"name":"mumbai","comment_count":66},
{"name":"chandigarh","comment_count":66}],
"org ": [{"name":"dell","comment_count":255},
{"name":"apple","comment_count":66},
{"name":"hp","comment_count":66}],
"teams" : [{"name":"Real","comment_count":255},
{"name":"Juve","comment_count":66},
{"name":"Liverpool","comment_count":66}]
};
這就是我想要的:
data2 = {
"location": [
{"name":"delhi","comment_count":255},
{"name":"mumbai","comment_count":66},
{"name":"chandigarh","comment_count":66}]
};
非常基本的東西 –
'data2.location = data.location;' –