code: protected function deserialize(array $document, $record = null): ResourceObject
      {
          $data = $document['data'] ?? [];
  
          if (!is_array($data) || empty($data)) {
              throw new \InvalidArgumentException('Expecting a JSON API document with a data member.');
          }
  
          return ResourceObject::create($data);
      }
docs: Deserialize a resource object from a JSON API document.
  
  @param array $document
  @param mixed|null $record
  @return ResourceObject