code: public function readAsJson(?IHttpBody $body): array
      {
          if ($body === null) {
              return [];
          }
  
          $json = json_decode($body->readAsString(), true);
  
          if ($json === null) {
              throw new RuntimeException('Body could not be decoded as JSON');
          }
  
          return $json;
      }
docs: Attempts to read the request body as JSON
  
  @param IHttpBody|null $body The body to parse
  @return array The request body as JSON
  @throws RuntimeException Thrown if the body could not be read as JSON