Let's say I have a JSON object that looks like this, called "prices"
"Scrap Metal": {
"defindex": [
5000
],
"prices": {
"3": {
"Tradable": {
"Craftable": {
"0": {
"currency": "keys",
"value": 432,
"last_update": 1425334795,
"difference": 3491.64
}
}
}
},
"6": {
"Tradable": {
"Craftable": {
"0": {
"currency": "metal",
"value": 0.11,
"last_update": 1336410088,
"difference": 0
}
}
}
}
}
},
This continues like this with a similar structure but different values. I want to search for the defindex: 5000
value and then get the value
from 6
from it. In other words, if I knew where it was in the code by searching the defindex, I would call "name".prices[6].Tradable.Craftable[0].value
.
I've tried to use underscore.js for this, but it didn't work. My code was:
_.where(prices, { defindex: '5000' });
Any help would be appreciated. Thanks!