private function isJsonString($string)
    {
        if (! is_string($string)) {
            return false;
        }
        
        $firstChar = substr($string, 0, 1);
        
        // If it starts the way a JSON object or array would, and parsing it as
        // JSON returns no errors, consider it a JSON string.
        if (($firstChar === '{') || ($firstChar === '[')) {
            json_decode($string);
            return (json_last_error() == JSON_ERROR_NONE);
        }
        
        return false;
    }
private function isJsonString($string)
    {
        if (! is_string($string)) {
            return false;
        }
        
        $firstChar = substr($string, 0, 1);
        
        // If it starts the way a JSON object or array would, and parsing it as
        // JSON returns no errors, consider it a JSON string.
        if (($firstChar === '{') || ($firstChar === '[')) {
            json_decode($string);
            return (json_last_error() == JSON_ERROR_NONE);
        }
        
        return false;
    }
private function isJsonString ( $ string ) { if ( ! is_string ( $ string ) ) { return false ; } $ firstChar = substr ( $ string , 0 , 1 ) ; // If it starts the way a JSON object or array would, and parsing it as // JSON returns no errors, consider it a JSON string. if ( ( $ firstChar === '{' ) || ( $ firstChar === '[' ) ) { json_decode ( $ string ) ; return ( json_last_error ( ) == JSON_ERROR_NONE ) ; } return false ; }
Determine whether the given value is a string that parses as valid JSON.

@param string $string The value to check.
@return boolean
Determine whether the given value is a string that parses as valid JSON .