code: private function decode(string $json): array
      {
          $data = json_decode($json, true);
  
          if (!is_array($data)) {
              throw new \InvalidArgumentException('The provided JSON is not valid.');
          }
  
          if (json_last_error() === JSON_ERROR_NONE) {
              return $data;
          }
  
          throw new \RuntimeException(json_last_error_msg());
      }
docs: Decodes the provided $json into an object or an array.
  
  @param string $json
  
  @throws \InvalidArgumentException if the provided json is not valid
  @throws \RuntimeException if the decoding throwed some errors
  
  @return array