我有一個字符串的JSON提供了以下VAR轉儲:json_decode上檢索到的JSON字符串從MySQL不工作
"[[{"TransactionID":"00416","OrderID":"000926","TransactionOrderItemID":"001123","LastUpdate":"2009-10-28 13:03:31","CustomerID":"184","Company_name":"Test123","Invoiced":"0","SubItemsCount":"2","ProductID":"1","ProductTypesID":"1","ProductTypeName":"Phone","ProductName":"Phone Line (Home)","IncludePST":"1","BillType":"Monthly","BillingCycle":"Monthly","Status":"Active","CreationDate":"2009-10-28","ActivationStartDate":"2009-10-28","NextNotificationDate":"2009-10-27","OverWritePrice":"-1","PriceEconomic":"26.00","BasePrice":"26.0000","ProRate":"Yes","InvoicePrice":"3.35","ServicePeriod":" Pro-Rate: Oct-28-2009 - Oct-31-2009","EndDate":"2009-10-31"}]]"
當我嘗試爲解碼:
json_decode($json, true);
結果就是空值。 $ json來自db。
請注意,我只顯示全數據的一個子集。 的問題是,這是從數據庫變量。如果雙引號是問題,如何投射?
我建議嘗試的問題在於你省略 – Greg 2009-10-28 18:25:08
博覽會的建議的部分。但是當我得到這個var轉儲並放入一個字符串時,它會按預期進行解碼。 – Natkeeran 2009-10-28 18:27:15
該字符串解碼很好,所以我同意格雷格。問題在於你沒有在這裏發佈的部分。 – zombat 2009-10-28 18:27:43