Hey everyone, could anyone here help me with php an decoding json? Im trying to decode the json api url from mining.bitcoin.cz.
Here is what I have at the moment:
$string = '
{
"username": "someusername",
"unconfirmed_reward": "0.08681793",
"send_threshold": "0.01000000",
"confirmed_reward": "0.02511418",
"workers":
{
"bitcoinjol.jason-laptop": {"last_share": 1307389634, "score": "0", "hashrate": 0, "shares": 0, "alive": false},
"bitcoinjol.david-laptop": {"last_share": 1307443495, "score": "1.7742", "hashrate": 24, "shares": 1, "alive": true},
"bitcoinjol.pierre-pc": {"last_share": 1307441804, "score": "0", "hashrate": 0, "shares": 0, "alive": true},
"bitcoinjol.testJol": {"last_share": 0, "score": "0", "hashrate": 0, "shares": 0, "alive": false}
},
"wallet": "asdasdjsadajdasjdsajasjdajdajs",
"estimated_reward": "0.00131061"
}'
;
$json_o = json_decode($string);
echo $json_o->username;
and this prints out "someusername" but I cant get it to print out the workers when I try:
echo $json_o->workers->someusername.jason-laptop;
I think that the "." or the "-" I am using are invalid?
I would like to be able to print out each worker and then the waller, username and rewards ect..
using arrays or these objects, either way. I have also tried splitting the $String on "," with explode, but cant get that to work nicely either.
If anyone could help me it would be much appretiated

jasrus(at)hotmail.co.za
What I usually do is take the result object and see if ARRAY or OBJECT is the data type of the branches:
To view the object. It is possible that the workers section is passed as an array in the object. So it may be like this:
Also the workers branch only consists of sub branches so the above probably needs to be:
if none of this helps.