public function EntityToJsonApi::normalize in JSON:API Extras 8.3
Same name and namespace in other branches
- 8.2 src/EntityToJsonApi.php \Drupal\jsonapi_extras\EntityToJsonApi::normalize()
Return the requested entity as an structured array.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to generate the JSON from.
string[] $includes: The list of includes.
Return value
array The JSON structure of the requested resource.
Throws
\Exception
File
- src/
EntityToJsonApi.php, line 131
Class
- EntityToJsonApi
- Simplifies the process of generating a JSON:API version of an entity.
Namespace
Drupal\jsonapi_extrasCode
public function normalize(EntityInterface $entity, array $includes = []) {
return Json::decode($this
->serialize($entity, $includes));
}