I am trying to get a value from a JSON array in Javascript :
The JSON array looks like :
[
{
"_id": 0,
"_entityMetadataList": [
{
"_metadataValue": "/storage/emulated/0/DCIM/.thumbnails/1524101696032.jpg",
},
{
"_metadataValue": "/storage/emulated/0/DCIM/.thumbnails/1524101694488.jpg",
}
],
"_timeCreated": "Tue Jan 15 06:10:04 2019\n",
"_timeUpdated": "Tue Jan 15 06:10:04 2019\n",
"objectEntity": {
"_id": 0,
"_EntitySiteGUID": -1
}
}
]
How I go about it :
app.post('/sound', function (req, res) {
let entitiesArray = req.body['filter'];
console.log('entitiesArray: ' + JSON.stringify(entitiesArray._entityMetadataList[0]._metadataValue))
(this is in a Node environment, by the way)
I, however keep getting the error :
TypeError: Cannot read property '0' of undefined