I have stored a JSON ouput into as a stdClass object using json_decode.
Ideally I want to echo the property names and values for the histogram object.
I tried
echo $obj->histogram->20000();
but it doesn't seem to recognise 20000 because it's a number. Also tried '20000'.
JSON code:
{
"location": {
"__CLASS__": "Adzuna::API::Response::Location",
"display_name": "Melbourne, Melbourne Region",
"area": [
"Australia",
"Victoria",
"Melbourne Region",
"Melbourne"
]
},
"__CLASS__": "Adzuna::API::Response::SalaryHistogram",
"histogram": {
"20000": 2,
"40000": 36,
"60000": 95,
"80000": 53,
"100000": 27,
"120000": 9,
"140000": 6
}
}
echo $json_obj->histogram->{'20000'};