I am having a little trouble grabbing data from JSON code. I am trying to grab "Message" value under "innererror" from the json code which is "entity : An error has occurred."
$json = '{
"odata.error":{
"code":"",
"message":{
"lang":"en-US",
"value":"The request is invalid."
},
"innererror":{
"message":"entity : An error has occurred.",
"type":"",
"stacktrace":""
}
}
}';
$json_data = json_decode($json,true);
$main_response_data = $json_data['innererror'];
echo $main_response_data[0]['message'];