We had this webservice running in Laravel 5 and AngularJs/Ionic for handling the web. When we post request from the web (client) to webservice (backend), we passed nested JSON object. We are having an issue to read all child objects under parent object in the server side.
{
"name": "test",
"description": "test",
"startdate": "2016-02-21T13:00:00.000Z",
"enddate": "2016-02-23T13:00:00.000Z",
"coach": {
"uuid": "76fdd664-d830-11e5-9d46-00ffc9587cbc"
},
"category": {
"uuid": "771e6de4-d830-11e5-9d46-00ffc9587cbc"
},
"useruuid": "76d65a2d-d830-11e5-9d46-00ffc9587cbc",
"routines": ["775b2726-d830-11e5-9d46-00ffc9587cbc"]
}
This JSON has been verified ok and I also we managed to get the basic one such as name, endate etc etc BUT not the nested object one.
We are using something like this in Laravel 5:
$incomingdata = $request->json()->all();
$name = $incomingdata->name; // works
$startdate = $incomingdata->startdate; // works
$coach_uuid = $incomingdata->coach()->uuid; // didn't work !!!
How do I achieve this?
json_decode()print_r($incomingdata);return?