I have the following JSON I am trying to parse the first object key/val Member ID (U1) but I am getting undefined. Any solution around this? I am retrieving the data from an external 3rd party API.
var data = { data:
[ { 'Member ID (U1)': 'monkey!',
MID: '123456',
'Advertiser Name': 'SampleAdvertiser',
'Order ID': 'ORDER12345',
'Transaction Date': '6/16/20',
'Transaction Time': '11:13:14',
SKU: 'SKU12345',
Sales: '100',
'# of Items': '1',
'Total Commission': '12.8',
'Process Date': '6/17/20',
'Process Time': '11:20:36' }]
}
data.data.forEach(transaction => {
var member_id = transaction['Member ID (U1)']
console.log(member_id) //prints undefined, expected monkey!
})
edit - turns out there is some weird special character in front of the "M". ended up copying that character in the for loop and now it works. Thank you SO!
jsontag?'Member ID (U1)'. Without it it gives the expected result.(Like in that code snippet)