JSON Array:
[ { sw: 'NODE.JS' }, { sw: 'Heroku Toolbelt' } ]
need to convert it to:
['NODE.JS','Heroku Toolbelt'].
Any quickest help will be highly apprecaited.
JSON Array:
[ { sw: 'NODE.JS' }, { sw: 'Heroku Toolbelt' } ]
need to convert it to:
['NODE.JS','Heroku Toolbelt'].
Any quickest help will be highly apprecaited.
I'd use Array.prototype.map
:
var new_array = arr.map(function(e) {
return e.sw;
});
Don't forget to get the actual JavaScript array from the JSON string with JSON.parse
(as an example).