2014-08-28 279 views
0

JSON的代碼是如下:解析JSON對象

{"data":[ 
{"data": 
{"created":"2014-02-26T21:14:56.662Z", 
"district":"4fd43cc56d11340000000005", 
"high_grade":"12", 
"last_modified":"2014-02-26T21:14:56.665Z", 
"location":{"address":"350 5th Avenue","city":"New York","state":"NY","zip":"10001"}, 
"low_grade":"9", 
"name":"Clever High School", 
"nces_id":"360008000000", 
"phone":"(212) 555-1212", 
"principal":{"name":"TheodoraKhan","email":"[email protected]"}, 
"school_number":"02M800", 
"sis_id":"02M800", 
"state_id":"712345","id":"530e595026403103360ff9fd"}, 
"uri":"/v1.1/schools/530e595026403103360ff9fd"}, 

{"data":{"created":"2014-02-26T21:14:56.668Z","district":"4fd43cc56d11340000000005","high_grade":"5","last_modified":"2014-02-26T21:14:56.670Z","location":{"address":"110 

菠蘿 街」, 「城市」: 「布魯克林」, 「狀態」: 「NY」, 「拉鍊」: 「11201」},「low_grade」:「幼兒園」,「姓名」:「聰明 小學」,「nces_id」:「360007000000」,「電話」:「(718) 555-4567」,「校長」: {「name」:「Cecilia Roderick」,「email」:「[email protected]」},「school_number」:「13K123」,「sis_id」:「13K123」,「state_id」:「30890」,「id 「:」530e595026403103360ff9fe「},」uri「:」/ v1.1/schools/530e595026403103360ff9fe「}

+0

'@ user3291422'可以驗證JSON? [已驗證的要點](https://gist.github.com/anonymous/9337256c884577d65585) – Shubh 2014-08-28 06:03:07

回答

0

我不太明白你在問什麼。

但是你可以使用以下命令:

$obj = json_decode($json_str); 
+0

如果不確定,爲什麼不作爲評論發問並僅在您確定時纔回答。這不是什麼stackoverflow? – Nabin 2014-08-28 04:37:36

+0

@Nabin這是一個措辭不佳的問題,但我的回答是正確的。 – tier1 2014-08-28 12:41:03

0

嘗試json_decode

$data = {"data":"a"}: 
$json = json_decode($data); 
echo $json->data;