-1

I have the following JSON format:

"also_known_as" : [ "Superman" ],
"business" : { "copyright_holder" : [ [ "Copyright MCMXLII Walt Disney Productions (on print)",
              " Walt Disney Productions",
              " 28 February 1942",
              " LP12270 (in copyright registry)"
            ] ]

So I'm able to parse to get the "also_known_as" section using:

$json_a = json_decode($THE_API_URL);

foreach($json_a as $mydata) {
echo  $mydata->also_known_as[0]
}

However can't get the date in the copyright_holder section i.e. "28 February 1942". Could someone please help me with the syntax.

Thanks.

4

1 回答 1

2

有关详细信息,请参阅http://php.net/manual/en/function.json-decode.php

您还可以仔细检查 json 字符串的格式是否正确。您发布的字符串没有正确 json_decode。

正如乔恩所说,一旦你把它解码,只需 var_dump 未序列化的 json 数组,看看一切是否正确。

您还可以通过http://www.jsoneditoronline.org/在线查看 JSON

于 2013-06-03T17:31:52.517 回答