i have this json on which i try to extract the insertion-orders array
{
"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
}
]
}
}
what im doing is TheJson is the json string:
$Json = json_decode($TheJson);
$JsonResponse = $Json->response;
$OrdersArray = $JsonResponse->insertion-orders;
the error im getting is :
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
line 16 is :
$OrdersArray = $JsonResponse->insertion-orders;
i just don't get it , its valid json
$JsonResponse->{'insertion-orders'}