上http://jsonformatter.curiousconcept.com/
{
"result":[
{
"vendor_id":"726",
"vendor_name":"Scusa"
},
{
"vendor_id":"519",
"vendor_name":"Emilie French Restaurant and Bar"
},
{
"vendor_id":"482",
"vendor_name":"Cassis French Fine Dining"
},
{
"vendor_id":"435",
"vendor_name":"Asuka Japanase Dining"
},
{
"vendor_id":"12050",
"vendor_name":"Taipan"
},
{
"vendor_id":"12061",
"vendor_name":"Social House"
},
{
"vendor_id":"12103",
"vendor_name":"Harum Manis Indonesian Restaurant"
},
{
"vendor_id":"12193",
"vendor_name":"Nanny\'s Pavillion (Central Park)"
},
{
"vendor_id":"12272",
"vendor_name":"Bistro Baron"
},
{
"vendor_id":"20704",
"vendor_name":"Kitchenette (Central Park)"
},
{
"vendor_id":"21217",
"vendor_name":"Kitchenette (Plaza Indonesia)"
},
{
"vendor_id":"29859",
"vendor_name":"Momento Restaurant And Bar"
},
{
"vendor_id":"31055",
"vendor_name":"Tortuga Kitchen And Bar"
},
{
"vendor_id":"31056",
"vendor_name":"Tuck And Chug"
},
{
"vendor_id":"31060",
"vendor_name":"AUROZ Gourmet Grill"
}
]
}
運行返回的JSON才發現這條線的無效字符
"vendor_name":"Nanny\'s Pavillion (Central Park)"
這是無效的JSON:'第33行解析錯誤: ...... 「VENDOR_NAME」: 「Nanny's Pavillion -----------------------^ 期待STRING,NUMBER,NULL,TRUE, FALSE','{','[''。檢出[JSONLint](http://www.jsonlint.com)並粘貼你的JSON來驗證它(這是逃脫的' ''在Nanny's Pavillion(中央公園)'這是造成這個問題的原因。)也許嘗試做一個'$ json_data = str_replace(「\'」,「'」,$ json_data);'因爲解析它。你也**使用'$ json_output ['result'] [0] ['vendor_name']'使它正常工作。 – h2ooooooo
Thx是驗證JSON數據的絕佳工具。 Thx .. – Jeremy