I am trying to insert additional data into a JSON structure. Here is the current structure:
[
{
"name": "Sam",
"ride": "My Ride test",
"session": "6htbgumjtmnxko6r",
"info": null
},
]
The variables I have are as follows:
var jsonData = [{
"name": "Sam",
"ride": "My Ride test",
"session": session,
"info": null
}];
jsonData.info = [];
I have attempted the following methods:
jsonData.info.push({
id: integer,
data: {
distance: currentDistance || 0,
lat: lat,
lon: lon
}
});
jsonData.push(jsonData.info);
jsonData[3].push(jsonData.info);
However, the result has not been successful:
[
{
"name": "Sam",
"ride": "My Ride test",
"session": "6htbgumjtmnxko6r",
"info": null
},
[
{
"id": 1,
"data": {
"distance": 0,
"lat": 53.6419743,
"lon": -1.7945115999999999
}
}
]
]
Can someone provide guidance on how to properly add data to the "info"
section of my jsonData?