Reputation: 2072
Here is what I try to convert:
[{"id":4,"name":"Group4"},{"id":6,"name":"Group6"}]
So I want to convert it into single JavaScript array like:
[4,6]
Upvotes: 0
Views: 45
Reputation: 9457
Use map
: inputArray.map(function (element) { return element.id; });
Upvotes: 3