As the title says I'm trying to read a JSON file that looks like the following:
{
"response": {
"current_time": 1490040712,
"success": 1,
"items": {
"AK-47 | Black Laminate (Minimal Wear)": {
"last_updated": 1490025658,
"value": 985,
"quantity": 124
},
"AK-47 | Aquamarine Revenge (Field-Tested)": {
"last_updated": 1490025658,
"value": 1775,
"quantity": 127
},
"AK-47 | Black Laminate (Field-Tested)": {
"last_updated": 1490025658,
"value": 890,
"quantity": 130
},
"AK-47 | Aquamarine Revenge (Battle-Scarred)": {
"last_updated": 1490025658,
"value": 1202,
"quantity": 70
},
}
}
}
Now what I'm trying to do is loop through the JSON file and check if, for example, "AK-47 | Aquamarine Revenge (Battle-Scarred)" is the same as a given string, then return it's value. I tried looking on the internet to get a good look of doing this but I didn't really get much smarter, I tried a few ways but they didn't go so well.
Something I tried:
var d, i;
for (i = 0; i < prices.response.items.length; i++) {
//d = prices.response.data[i];
itemPrice = i;
}
This piece was for testing to just return at least something, but it doesn't work at all, can someone help me?
Kind regards!