PHP parsing JSON with variable key values
I have some json that would like to parse thru without hardcoding the
subvalues so others than me can use this as well. Example of the JSON is:
{
"payout_history":"0",
"round_shares":"1816",
"workers":
{
"jbo.5970":
{
"alive":"1",
"hashrate":"1253"
},
"jbo.5970cpu":
{
"alive":"1",
"hashrate":"21"
},
"jbo.5970-2":
{
"alive":"1",
"hashrate":"1062"
}
}
}
So those jbo level items I can directly access by ['workers']['jbo.5970']
however tried like ['workers][0] but nothing was returned. Want to parse
thru all the items under workers and then process the array elements in
each jbo value which could be a completely different named values.
Thoughts?
Thanks.
No comments:
Post a Comment