public static function isJson($data) {
        if (!is_string($data) || empty($data)) {
            return false;
        }

        $json = @json_decode($data, true);

        return (json_last_error() === JSON_ERROR_NONE && $json !== null);
    }
public static function isJson($data) {
        if (!is_string($data) || empty($data)) {
            return false;
        }

        $json = @json_decode($data, true);

        return (json_last_error() === JSON_ERROR_NONE && $json !== null);
    }
public static function isJson ( $ data ) { if ( ! is_string ( $ data ) || empty ( $ data ) ) { return false ; } $ json = @ json_decode ( $ data , true ) ; return ( json_last_error ( ) === JSON_ERROR_NONE && $ json !== null ) ; }
Check to see if data passed is a JSON object.

@param mixed $data
@return bool
Check to see if data passed is a JSON object .