我有條紋json,我試圖解碼它json_decode。解碼條紋json json_decode不工作
我沒有收到錯誤。只是沒有回報。我從條紋中獲取數據,我只是無法解碼它。
{
"created":1326853478,
"data":{
"object":{
"amount":4500,
"card":{
"country":"US",
"cvc_check":"pass",
"exp_month":7,
"exp_year":2014,
"fingerprint":"9aQtfsI8a17zjEZd",
"id":"cc_00000000000000",
"last4":"9782",
"object":"card",
"type":"Visa"
},
"created":1322700852,
"currency":"usd",
"disputed":false,
"fee":0,
"id":"ch_00000000000000",
"livemode":false,
"object":"charge",
"paid":true,
"refunded":true
}
},
"id":"evt_00000000000000",
"livemode":false,
"type":"charge.refunded"
}
// retrieve the request's body and parse it as JSON
$body = @file_get_contents('php://input');
$event_json = json_decode($body,true);
print_r($event_json);
任何想法?
呀。刪除隱藏任何錯誤消息的字符。 –
Igancio指的是@字符。 – Hamish
也可以用'json_last_error()'和/或http://jsonlint.com/來檢查,你可能在那裏有一個UTF-8 BOM。 – mario