diff --git a/README.md b/README.md index 475cd5d..94df596 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ The list of endpoints then looks like the following: ## Development usage -It is also possible to obtain the JSON representation of a supported entity: +It is also possible to obtain the JSON API representation of a supported entity: // For a given $entity object. $json = \Drupal::service('jsonapi.entity.to_json')->normalizeEntity($entity); diff --git a/src/ToJson.php b/src/ToJson.php index cfde37c..47394ca 100644 --- a/src/ToJson.php +++ b/src/ToJson.php @@ -50,7 +50,7 @@ public function __construct(ContentEntityNormalizer $normalizer, SerializerInter */ public function serializeEntity(EntityInterface $entity) { $normalized_entity = $this->normalizeEntity($entity); - return $this->serializer->serialize($normalized_entity, 'json'); + return $this->serializer->serialize($normalized_entity, 'api_json'); } /**