Hi i am working on php webservices and i am stucked with receving jsonarray as post request . i am able to receve other objects apart from jsonarray easily. My json structure looks like the following
{
"full_name" :"amn",
"phone":"9902",
"educational_details":[
{"board":"a","grade":"b","percentage":"21.0"},
{"board":"a1","grade":"b1","percentage":"22.0"}
]
}
Here is my following php code to decode json
$data = json_decode(file_get_contents('php://input'), true);
$fullname=$data['full_name'];
$phone=$data['phone'];
$email=$data['email'];
$nativeaddress=$data['native_address'];
$fresher=$data['fresher'];
$skills=$data['skills'];
$resumeUri=$data['resume_uri'];
$obj = $data['educational_details'];
$obj1=json_decode($obj,true);
echo "arrayval".$obj1;
Any Help would be much appreciated.. Thanks in advance :)
This was the solution as given by someone above and worked perfectly
foreach($obj as $val){
echo "<br>Board = " .$val['board']." <br>Grade = ".$val['grade'] ."<br> Percentage =".$val['percentage'];
$board=$val['board'];
$grade=$val['grade'];
$percentage=$val['percentage'];
$percentageval = floatval($percentage);
}