Looking at your data, sc_data
is an array containing nested JSON objects so you should be able to iterate over that array to read the data like you want:
echo $data['sc_data'][0]['log_visits'];
The code above will access the first element of the array sc_data
and print the value of log_visits
When you have {"field":['a','b','c']}
in JSON, you would access 'a'
as field[0]
.
The elements of the array can be any valid value, i.e.
- string
- number
- object
- array
- true
- false
- null
In your case it is objects and you access that object the same way you would access any other array element - by the index number (JSON doesn't have associative array of type "key" => "value"
)