I have a question about querying JSON structures that make use of nested objects. In order to explain, I will use some examples.
For Examples Sake, the variable $json is a JSON file:
movies [{"name":"good movie", "poster":"link"}]
Normally after I've used the json_decode() function on a JSON file I can do something like
$newFiles = $json["movies"];
foreach ($newFiles as $file) {
$name = $file["name"]; }
But, lets say I have this JSON File:
movies[{"name":"good movie", "poster": {"original":"link", "smaller":"link"}}]
How would I get the value of "original", I've tried doing something like:
$newFiles = $json["movies"];
foreach ($newFiles as $file) {
$poster = $file["poster" -> "original"]; }
That, however, doesn't work. I can't find the appropriate syntax to query this. Any help appreciated, thanks in advance!