I am trying to parse this json '{"options":"[{\"order\":\"1\"},{\"skill\":\"\\n wajghjk \"},{\"order\":\"2\"},{\"skill\":\"\\n aswedrty \"},{\"order\":\"3\"},{\"skill\":\"\\n skill1 \"},{\"order\":\"4\"},{\"skill\":\"\\n wasedjk \"},{\"order\":\"5\"},{\"skill\":\"\\n Feldsher \"},{\"order\":\"6\"},{\"skill\":\"\\n wasedjk \"},{\"order\":\"7\"},{\"skill\":\"\\n Autotransfusionist \"},{\"order\":\"8\"},{\"skill\":\"\\n Feldsher \"},{\"order\":\"9\"},{\"skill\":\"\\n Autotransfusionist \"}]"}' . using the code
<?php
$json = '{"options":"[{\"order\":\"1\"},{\"skill\":\"\\n wajghjk \"},{\"order\":\"2\"},{\"skill\":\"\\n aswedrty \"},{\"order\":\"3\"},{\"skill\":\"\\n skill1 \"},{\"order\":\"4\"},{\"skill\":\"\\n wasedjk \"},{\"order\":\"5\"},{\"skill\":\"\\n Feldsher \"},{\"order\":\"6\"},{\"skill\":\"\\n wasedjk \"},{\"order\":\"7\"},{\"skill\":\"\\n Autotransfusionist \"},{\"order\":\"8\"},{\"skill\":\"\\n Feldsher \"},{\"order\":\"9\"},{\"skill\":\"\\n Autotransfusionist \"}]"}';
$decode = json_decode($json, true);
$a=array();
echo '<br/>';
foreach($decode['options'] as $a)
{
echo $a['order'];echo '<br/>';
echo $a['skill'];echo '<br/>';
}
?>
But it is showing error and not able to parse . Is there any better way to get the values of order and skill from this json ?