Use .map()
function:
finalArray = someJsonArray.map(function (obj) {
return obj.id;
});
Snippet
var someJsonArray = [
{id: 0, name: "name", property: "value", therproperties: "othervalues"},
{id: 1, name: "name1", property: "value1", otherproperties: "othervalues1"},
{id: 2, name: "name2", property: "value2", otherproperties: "othervalues2"}
];
var finalArray = someJsonArray.map(function (obj) {
return obj.id;
});
console.log(finalArray);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…