code: public function parserHttpRequest(HttpRequest $httpRequest)
      {
          $json = \json_decode($httpRequest->getContent(), true);
  
          if (JSON_ERROR_NONE !== \json_last_error()) {
              throw new Exceptions\ParseException();
          }
  
          /**
           * Create new JsonRequest.
           *
           * @param array $json
           *
           * @return JsonRequest
           */
          $createJsonRequest = function ($json) use ($httpRequest) {
              $id = null;
              $method = null;
              $params = [];
  
              if (\is_array($json)) {
                  $id = \array_key_exists('id', $json) ? $json['id'] : null;
                  $method = \array_key_exists('method', $json) ? $json['method'] : null;
                  $params = \array_key_exists('params', $json) ? $json['params'] : [];
              }
  
              $request = new JsonRequest($method, $params, $id);
              $request->headers()->add($httpRequest->headers->all());
  
              return $request;
          };
  
          // If batch request
          if (\array_keys($json) === \range(0, \count($json) - 1)) {
              $requests = [];
              foreach ($json as $part) {
                  $requests[] = $createJsonRequest($part);
              }
          } else {
              $requests = $createJsonRequest($json);
          }
  
          return $requests;
      }
docs: Parser HttpRequest to JsonRequest.
  
  @param HttpRequest $httpRequest
  
  @throws Exceptions\ParseException
  
  @return JsonRequest|JsonRequest[]