How can I remove \ ??
$labType=array();
foreach ($landslide->testingDetailLab as $lab) {
$labType[]= $lab;
}
$problemiden =array();
foreach($landslide->problemIdentification as $problem){
$problemiden[]=($problem);
}
$data = [
"lab_type"=>json_encode($labType),
"problem_identifiation"=>json_encode($problemiden),
]
Tried to get proper json string ,is there any way to remove / form json string
How can i get it in this format:
CodePudding user response:
I think you are looking for JSON_UNESCAPED_SLASHES
flag.
$labType = [];
foreach ($landslide->testingDetailLab as $lab) {
$labType[] = $lab;
}
$problemiden = [];
foreach ($landslide->problemIdentification as $problem) {
$problemiden[] = $problem;
}
$data = [
"lab_type" => json_encode($labType,JSON_UNESCAPED_SLASHES),
"problem_identifiation" => json_encode($problemiden,JSON_UNESCAPED_SLASHES),
];
CodePudding user response:
I guess you could try something like
json_encode(json_decode($labType))