Ip\Internal\Design\Helper::json_clean_decode PHP Method

json_clean_decode() public method

Work like the original php json_decode() function with the same params
public json_clean_decode ( string $json, boolean $assoc = false, integer $depth = 512, integer $options ) : string
$json string The json string being decoded
$assoc boolean When TRUE, returned objects will be converted into associative arrays.
$depth integer User specified recursion depth. (>=5.3)
$options integer Bitmask of JSON decode options. (>=5.4)
return string
    function json_clean_decode($json, $assoc = false, $depth = 512, $options = 0)
    {
        // search and remove comments like /* */ and //
        $json = preg_replace("#(/\\*([^*]|[\r\n]|(\\*+([^*/]|[\r\n])))*\\*+/)|([\\s\t](//).*)#", '', $json);
        $json = json_decode($json, $assoc, $depth, $options);
        return $json;
    }