i've build an API for myself to return some data , this data is returned in json form like that
{
[
{
"name": "John Doe",
"year": "1st",
"curriculum": "Arts"
}
]}
the problem is that i can't accesss any field of this data , i've been trying it on REST client by these inputs
{
"test" : {
[
{
"name": "John Doe",
"year": "1st",
"curriculum": "Arts"
}
]}}
the "test" is the name of the input passed from the android to the API.
when i make a request like the above i get nothing , but when doing something like
{
"test" :
[
{
"name": "John Doe",
"year": "1st",
"curriculum": "Arts"
}
]}
handling it with this code
$test = $request->input('test');
$final_Length_Array = array('list', $test);
$var = $final_Length_Array[1][0]['name'];
return response()->json([
'state' => '1',
'test' => $var
]);
i get me desired value , now if any one can tell me how to deal with it ?