i am trying to access the values from ETH_MOD etc. inside a foreach to output the name like ETH_MOD and the last value. the problem is that the keys like ETH_MOD and ETH_LTG are dynamic. They change from time to time and also more new pairs are added.
hope somebody understand my problem and can help ;)
in php i am doing it like this. Here i have the "Name" in $key
$cls = json_decode($json);
foreach ($cls as $key => $value) {
$last= transformNumber($value->last);
$bid= transformNumber($value->bid);
$ask= transformNumber($value->ask);
}
kind regards
{
"returnTicker": {
"ETH_MOD": {
"tokenAddr": "0x957c30ab0426e0c93cd8241e2c60392d08c6ac8e",
"quoteVolume": 401812,
"baseVolume": 2398.702,
"last": 0.005690802,
"percentChange": 0.0737,
"bid": 0.005650001,
"ask": 0.00579
},
"ETH_LTG": {
"tokenAddr": "0x0879e0c9822b75f31f0b0ed2a30be9f484a57c2f",
"quoteVolume": 35336143,
"baseVolume": 1767.741,
"last": 4.9993E-05,
"percentChange": 3.1661,
"bid": 4.65E-05,
"ask": 4.874E-05
},
"ETH_ATM": {
"tokenAddr": "0x9b11efcaaa1890f6ee52c6bb7cf8153ac5d74139",
"quoteVolume": 9114955.042,
"baseVolume": 1641.045,
"last": 0.000177983,
"percentChange": -0.0167,
"bid": 8.0009E-05,
"ask": 8.38E-05
},
"ETH_VERI": {
"tokenAddr": "0x8f3470a7388c05ee4e7af3d01d8c722b0ff52374",
"quoteVolume": 3632.34,
"baseVolume": 617.863,
"last": 0.164501,
"percentChange": -0.015,
"bid": 0.168,
"ask": 0.1695
},
"ETH_ITS": {
"tokenAddr": "0xfd784da5c740c617aafb80399fa81b86e1da99a5",
"quoteVolume": 206921.3,
"baseVolume": 124.563,
"last": 0.000506,
"percentChange": 0.3316,
"bid": 0.0002667,
"ask": 0.0005588
}
},
"trades": [],
"orders": {
"buys": [],
"sells": []
}
}