Determine if the request is sending JSON.

@return bool
430790
public function isJson()
    {
        $header = $this->headers->get('CONTENT_TYPE');

        if (strpos($header, 'json') !== false) {
            return true;
        }

        return false;
    }
1342230
public function hasJson(...$args): bool
    {
        if (!count($args)) {
            return $this->exists('json');
        }

        return $this->exists('json', ...$args);
    }
452084
protected function getJSONArg ($name)
	{
		return isset ($this->request['json']->$name)? $this->request['json']->$name : FALSE;
	}
673794
protected function hasValidJson($jsonError)
    {
        if ($jsonError === JSON_ERROR_NONE) {
            return true;
        }

        return $this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR) &&
                    in_array($jsonError, [
                        JSON_ERROR_RECURSION,
                        JSON_ERROR_INF_OR_NAN,
                        JSON_ERROR_UNSUPPORTED_TYPE,
                    ]);
    }
1239117
public function isAjax()
    {
        if (!isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
            return false;
        }

        $xhr_obj = Str::lower($_SERVER['HTTP_X_REQUESTED_WITH']);

        if ($xhr_obj == 'xmlhttprequest' || $xhr_obj == 'activexobject') {
            return true;
        }

        return false;
    }
1117161
public function getJson()
    {
        global $CFG, $PDOX;

        $row = $PDOX->rowDie("SELECT json FROM {$CFG->dbprefix}{$this->TABLE_NAME}
                WHERE $this->PRIMARY_KEY = :PK",
            array(":PK" => $this->id));
        if ( $row === false ) return false;
        $json = $row['json'];
        if ( $json === null ) return false;
        return $json;
    }
684487
public function isAjaxRequest()
    {
        return (
            (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
            || !empty($this->getRequest('ajax'))
            || !empty($this->getRequest('ajax_cb'))
            || !empty($this->getRequest('if_cb'))
        );
    }
210711
private function isJsonRequestValid(Request $request, $methods)
    {
        $methods = $this->getMethods($methods);

        return ! (
            in_array($request->method(), $methods) &&
            ! $request->isJson()
        );
    }
58423
public function isAjax() {
        return (isset($this->http->xRequestedWith) && $this->http->xRequestedWith = 'XMLHttpRequest' ||
                isset($this->http->requestedWith) && $this->http->requestedWith = 'XMLHttpRequest');
    }
783689
protected function decoded()
	{
		if ($this->json === null) {
			/** @var \Guzzle\Http\Message\Header $contentType */
			$contentType = (string)$this->response->getHeader('content-type');
			if ($contentType === 'application/json')
				$this->json = json_decode($this->response->getBody(true));
		}

		return $this->json;
	}
207978
public function isJsonApi()
    {
        if ($this->data instanceof \FreeFW\JsonApi\V1\Model\ResourceObject) {
            return true;
        } else {
            die('trtrtr');
        }
        return false;
    }
1141924
public function isJson()
    {
        if ($this->is_json === null) {
            $this->is_json = strpos($this->getContentType(), 'application/json') !== false;
        }

        return $this->is_json;
    }
1129947
public function isValidCallbackRequest()
    {
        if (!$this->isValidHubSignature()) {
            return false;
        }

        $decoded = $this->getDecodedBody();

        $object = isset($decoded['object']) ? $decoded['object'] : null;
        $entry = isset($decoded['entry']) ? $decoded['entry'] : null;

        return $object === 'page' && null !== $entry;
    }
848378
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);
    }
787230
protected function _checkRequestMethods()
    {
        if ($this->_request()->is('put')) {
            throw new BadRequestException('JSON API does not support the PUT method, use PATCH instead');
        }

        if (!$this->_request()->contentType()) {
            return true;
        }

        $jsonApiMimeType = $this->_response()->getMimeType('jsonapi');

        if ($this->_request()->contentType() !== $jsonApiMimeType) {
            throw new BadRequestException("JSON API requests with data require the \"$jsonApiMimeType\" Content-Type header");
        }

        return true;
    }
403363
protected function isJsonRequest()
    {
        $ajax = false;

        if (!empty($_SERVER['HTTP_X_REQUESTED_WITH'])
           && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
            $ajax = true;
        }

        return $ajax && !isset($_GET['__atk_tab']);
    }
97836
protected function isAjax() : bool 
    {
        $header = $this->request->getHeaders()->get('X-Requested-With');

        if ($header === null) {
            return false;
        }
        
        return $header->getValue() === 'XMLHttpRequest';
    }