I'm working with apps script and have:
var json = UrlFetchApp.fetch(url);
var objArray = JSON.parse(json)
Logger.log(objArray);
const indices = objArray.map(({ ' #':id }) => id);
Logger.log(indices);
Logger.log(objArray) gives:
[{ #=4626, E=Yes, Assd $=, Eager=High, New $=, State=Louisiana, Date=06/15/20, County=St. Martin Parish}, { #=4623, State=South Carolina, E=Yes, Acres=1.50, Eager=Low, Date=06/15/20, New $=}, { County=Sedgwick County, Eager=High, Acres=0.13, New $=, E=No, #=4620, Date=06/15/20, State=Kansas}, ....
Logger.log(indices) gives:
[null, null, ....... null]
However the following:
const values = [
{ " #": "4596", " E": "Yes"},
{ " #": "4597", " E": "No"},
{ " #": "4598", " E": "Maybe"},
]
const indices = values.map(({ " #" : id }) => id);
console.log(indices);
when run in apps script produces:
[4596,4597,4598]
Why does the first not work ?
edit:
json:
[{" #":"4626"," E":"Yes"," Date":"06/15/20"," County":"St. Martin Parish"," State":"Louisiana"," Acres":"15.00"," Eager":"High"},{" #":"4623"," E":"Yes"," Date":"06/15/20"," County":"Greenville County"," State":"South Carolina"," Acres":"1.50","Eager":"Low"},