-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;' –