将对象数组转换为属性数组

14 浏览
0 Comments

将对象数组转换为属性数组

是否有一种简单的方法,可以使用filterparse或其他方式将类似以下的数组转换为一个简单的数组,该数组只包含前一个数组中对象的一个属性,如下所示:

var someJsonArray = [
  {id: 0, name: "name", property: "value", otherproperties: "othervalues"},
  {id: 1, name: "name1", property: "value1", otherproperties: "othervalues1"},
  {id: 2, name: "name2", property: "value2", otherproperties: "othervalues2"}
];

转换结果如下:

[0, 1, 2]

0