What does "@" mean in JSON?
I am using the following library
https://github.com/Leonidas-from-XIV/node-xml2js
Converting XML to JSON. After conversion, console.log creates 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 the data is supposed to be stored in a variable named "result", what is the syntax for accessing RaceDayDate, year, month, etc.? result. @does not work
+3
source to share
4 answers
I'm not sure if this applies to this example, but I am currently integrating with an API that allows xml or json to be passed; in json messages, any field that is stored as an attribute in the xml version of this message is prefixed with the "@" symbol. I guess this is because the json is converted to xml for processing and whatever tool they use to do this is using @ to distinguish between elements and attributes.
0
source to share