I have a ETHBTC.json file :
[
{
"open": "0.06353900",
"high": "0.06354800",
"low": "0.06341700",
"close": "0.06347300",
"volume": "335.48500000",
"timestamp": 1521640800000
},
{
"open": "0.06347300",
"high": "0.06365400",
"low": "0.06344000",
"close": "0.06357500",
"volume": "461.02800000",
"timestamp": 1521641100000
},
{
"open": "0.06349500",
"high": "0.06360400",
"low": "0.06341400",
"close": "0.06352300",
"volume": "495.50600000",
"timestamp": 1521641400000
}
]
I'm trying to loop through the data and save all of the 'low' values to an array
const fs = require('fs');
var data = fs.readFileSync('charts/ETHBTC.json');
var CurrentPair = JSON.parse(data);
var lowTotal = [];
for(item in CurrentPair){
lowTotal[item] = item.low;
console.log(lowTotal[item]); //put this just to check if working.
}
the console log is giving me undefined values. Any help would be great, thanks