我有这个 json,我尝试在其上提取插入订单数组
{
"response" : {
"status" : "OK",
"count" : 1,
"insertion-orders" : [{
"id" : 5,
"name" : "First Choice",
"code" : null,
"state" : "active",
"line_items" : [{
"id" :352,
"timezone" : "Europe/London"
}, {
"id" :358,
"timezone" : "Europe/London"
}
],
"labels" : null,
"safety_pacing" : true
}
]
}
}
我在做什么是TheJson是json字符串:
$Json = json_decode($TheJson);
$JsonResponse = $Json->response;
$OrdersArray = $JsonResponse->insertion-orders;
我得到的错误是:
Notice: Undefined property: stdClass::$insertion in /home/foo/a/foo.com/user/htdocs/FunctionManager.php on line 16
Notice: Use of undefined constant orders - assumed 'orders' in /home/foo/a/foo.com/user/htdocs/FunctionManager.php on line 16
第 16 行是:
$OrdersArray = $JsonResponse->insertion-orders;
我只是不明白,它的有效 json