I'm using the following library
https://github.com/Leonidas-from-XIV/node-xml2js
To convert XML to JSON. After conversion console.log produces the following
{ '@':
{ RaceDayDate: '2012-03-15T00:00:00',
Year: '2012',
Month: '3',
Day: '15',
DayOfTheWeek: 'Thursday',
MonthLong: 'March',
IsCurrentDay: '1',
IsPresaleMeeting: '0',
ServerTime: '2012-03-15T19:48:47.840' },
PresaleRaceDate: [ { '@': [Object] }, { '@': [Object] }, { '@': [Object] } ],
Meeting:
[ { '@': [Object], Pool: [Object], Race: [Object] },
{ '@': [Object], Pool: [Object], Race: [Object] },
{ '@': [Object], Pool: [Object], Race: [Object] },
What does @ mean and assuming the data is stored in a variable named 'result' what is the syntax for accessing RaceDayDate, Year, Month etc? result.@ does not work
'@'
is just a string like any other. In JavaScript, you can access it with
result['@']
Also note that the input is not valid JSON, as it is missing quotes around many dictionary keys and Object
, uses single instead of double quotes and ends with a comma.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With