original_string: protected function getRequestJson()
      {
          if ($this->request->getContentType() !== 'json') {
              throw new UserMessageException(t('Invalid request Content-Type: %s', $this->request->headers->get('Content-Type', '')), Response::HTTP_NOT_ACCEPTABLE);
          }
          $contentBody = $this->request->getContent();
          $contentJson = @json_decode($contentBody, true);
          if (!is_array($contentJson)) {
              throw new UserMessageException(t('Failed to parse the request body as JSON'), Response::HTTP_NOT_ACCEPTABLE);
          }
  
          return $contentJson;
      }
code: protected function getRequestJson()
      {
          if ($this->request->getContentType() !== 'json') {
              throw new UserMessageException(t('Invalid request Content-Type: %s', $this->request->headers->get('Content-Type', '')), Response::HTTP_NOT_ACCEPTABLE);
          }
          $contentBody = $this->request->getContent();
          $contentJson = @json_decode($contentBody, true);
          if (!is_array($contentJson)) {
              throw new UserMessageException(t('Failed to parse the request body as JSON'), Response::HTTP_NOT_ACCEPTABLE);
          }
  
          return $contentJson;
      }
code_tokens: protected function getRequestJson ( ) { if ( $ this -> request -> getContentType ( ) !== 'json' ) { throw new UserMessageException ( t ( 'Invalid request Content-Type: %s' , $ this -> request -> headers -> get ( 'Content-Type' , '' ) ) , Response :: HTTP_NOT_ACCEPTABLE ) ; } $ contentBody = $ this -> request -> getContent ( ) ; $ contentJson = @ json_decode ( $ contentBody , true ) ; if ( ! is_array ( $ contentJson ) ) { throw new UserMessageException ( t ( 'Failed to parse the request body as JSON' ) , Response :: HTTP_NOT_ACCEPTABLE ) ; } return $ contentJson ; }
docstring: Check if the request is a JSON request and returns the posted parameters.
  
  @throws UserMessageException
  
  @return array
docstring_tokens: Check if the request is a JSON request and returns the posted parameters .