Plain:
var data = [{"name":"Marine Lines","location_id":3},{"name":"Ghatkopar","location_id":2}] var result = data.map(function(val) { return val.location_id; }).join(','); console.log(result)
I assume you need a string, so .join(',') if you want the array to just delete this part.
source share