<?php
$text ='{"success":true,"result":[{"product_id":"","faq_no":"FAQ1","faqcategories":"General","faqstatus":"Published","question":"\u062a\u0633\u062a \u062f\u0627\u0631\u061f","faq_answer":"\u0646\u062f\u0627\u0631\u062f","createdtime":"2017-11-20 08:35:47","modifiedtime":"2017-11-20 08:35:47","modifiedby":"19x1","source":"CRM","starred":"0","tags":"","id":"3x12"}}';
function cleanjson($text){
$newjson = explode("{",$text);
$newjsonrightclean="{".$newjson[1]."{".$newjson[2];
$newjson2 = explode("}}",$newjsonrightclean);
if (!empty($newjson2[1])){
$out = $newjson2[0]."}}";
return $out;
}else{
$newjson3 = explode("]}",$newjsonrightclean);
$out = $newjson3[0]."]}";
return $out;
}
}
echo cleanjson($text) ;
- Output for 7.0.0 - 7.0.25, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
- {"success":true,"result":[{"product_id":"","faq_no":"FAQ1","faqcategories":"General","faqstatus":"Published","question":"\u062a\u0633\u062a \u062f\u0627\u0631\u061f","faq_answer":"\u0646\u062f\u0627\u0631\u062f","createdtime":"2017-11-20 08:35:47","modifiedtime":"2017-11-20 08:35:47","modifiedby":"19x1","source":"CRM","starred":"0","tags":"","id":"3x12"}}]}
preferences:
182.86 ms | 404 KiB | 192 Q