2011-01-07 93 views
-2

我有以下json數組。第三方json格式化功能沒有按預期工作

 { "files": [ { "Name": "4c9c49b73bd3a", "Attributes": { 
"title": "Winter.jpg", "file_size": 
"105542", "url": 
"http:\/\/dtzhqpwfdzscm.cloudfront.net\/4c9c49b73bd3a.jpg", 
"file_name": "4c9c49b73bd3a.jpg", 
"time_stamp": "1285310908", 
"file_type": "image\/jpeg", 
"content_obj_type": "upload", "thumb": 
"http:\/\/dtzhqpwfdzscm.cloudfront.net\/4c9c49b73bfef.jpg", 
"width": "183.13253012048193", 
"height": "169", "userid": "1", 
"gibid": "1", "contentid": 
"4c9c49b73bd3a", "qqfile": 
"Winter.jpg", "original_name": 
"Winter.jpg", "y": 
"44.51666259765625", "x": "626", 
"on_floor": "false", "success": 
"true", "gibview": "O", "resize": 
"true" } }, { "Name": "4ce4fbb33c388", 
"Attributes": { "title": "Rediff 1", 
"file_size": "", "url": 
"http:\/\/rediff.com\/", "file_name": 
"", "time_stamp": "1290075059", 
"file_type": "html", 
"content_obj_type": "link", "thumb": 
"http:\/\/dtzhqpwfdzscm.cloudfront.net\/4ce4fbb010e92.html", 
"width": "100", "height": "100", 
"link": "rediff.com", "userid": "1", 
"gibid": "1", "contentid": 
"4ce4fbb33c388", "y": "611", "x": 
"233", "on_floor": "true", "success": 
"true", "gibview": "O" } } ], 
"success": "true", "message": null } 

我使用this頁面的json_format功能

echo json_format(json_encode($array)); 

請建議是什麼問題,爲什麼這個JSON是沒有得到格式化。

+1

你得到了json,你有這個功能,並且你有問題嗎?請你想要達到什麼目的? – 2011-01-07 05:53:05

+0

@poelinca這個功能沒有在做格式化。 – XMen 2011-01-07 05:54:28

回答

0

嘗試這種情況:

回波json_format(json_encode($陣列,JSON_FORCE_OBJECT));