Drupal is a registered trademark of Dries Buytaert
cms 2.1.3 Update released for Drupal core (2.1.3)! drupal 10.5.11 Update released for Drupal core (10.5.11)! drupal 11.3.11 Update released for Drupal core (11.3.11)! drupal 11.2.13 Update released for Drupal core (11.2.13)! drupal 10.6.10 Update released for Drupal core (10.6.10)! cms 2.1.2 Update released for Drupal core (2.1.2)! drupal 11.1.10 Update released for Drupal core (11.1.10)! drupal 10.5.10 Update released for Drupal core (10.5.10)! drupal 10.4.10 Update released for Drupal core (10.4.10)! drupal 11.2.12 Update released for Drupal core (11.2.12)! drupal 11.3.10 Update released for Drupal core (11.3.10)! drupal 10.6.9 Update released for Drupal core (10.6.9)! drupal 10.6.8 Update released for Drupal core (10.6.8)! drupal 11.3.9 Update released for Drupal core (11.3.9)! drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)!

entity_display_json

28 sites Security covered
View on drupal.org

Summary

A read-only JSON API for Drupal entities, driven by your existing Manage Display configuration. Designed for decoupled and headless consumers — React, Vue, Svelte, native apps, edge renderers — that want the same field visibility and formatter settings as a configured display mode, without rebuilding renderable arrays or maintaining a hand-written field map.
Configure a view display once and you get a stable JSON contract: hidden fields stay hidden, view modes propagate to referenced entities, label settings come through. Editors changing how content looks never reshape the data shape your frontend depends on.

Endpoints

  • GET /ejson — site name, slogan, language map, homepage pointer.
  • GET /ejson/resolve?path=/about-us — translates a path or alias into a {entity_type, uuid, id, display_id} pointer your frontend follows with a build call.
  • GET /ejson/{entity_type}/{uuid}/{display_id} — serializes an entity (or view) using the named view display. display_id defaults to default.

All three routes are gated by a single permission, Access Entity Display JSON endpoints.

Highlights

  • Display-driven — whatever you configure under Manage Display is what shows up in JSON.
  • One call, full page — referenced entities, paragraphs, media and files are walked recursively using each component's view mode, so a single request returns the whole tree.
  • Access-aware — per-entity and per-field view access is enforced; fields the current user cannot see are omitted.
  • Cacheable by default — entity, field, config and view cache tags bubble into a CacheableJsonResponse automatically, with the right cache contexts on top.
  • Views and blocks — view rows are processed through the row view mode; views_block:* plugins (via Block Field) are serialized the same way.
  • Multilingual — append ?lang=xx for a specific translation.
  • Safe recursion — cycles and deep nesting emit _stub: true markers with a _stub_reason (cycle or depth) instead of looping.
  • Frontend types — a JSON Schema for the invariant payload contract ships in schema/entity-payload.schema.json; pipe it through json-schema-to-typescript for free types.
  • Field groups (from the field_group module) are preserved as nested structures.

Extending without forking

The module is plugin- and hook-driven, so site code shapes the output without patching it:

  • Field value extractor plugins — implement FieldValueExtractorInterface and tag a class with the #[FieldValueExtractor] attribute to take over serialization for a field type, a formatter type, or both. Plugins are weight-ordered and the first whose applies() returns TRUE wins.
  • hook_entity_display_json_field_alter — tweak a single field's value after extraction.
  • hook_entity_display_json_entity_alter — reshape the full entity payload, inject hidden fields, or add computed properties.
  • hook_entity_display_json_response_alter — extend the top-level HTTP envelope.
  • hook_entity_display_json_field_value_extractor_info_alter — reweight or swap any built-in extractor.

Per-field opt-ins via display component third-party settings:

  • multi_value — force array or scalar output regardless of storage cardinality.
  • render — run formatted-text fields through check_markup so the output matches the filtered HTML the display would render.

Programmatic API

$builder = \Drupal::service('entity_display_json.builder');
$data = $builder->serialize($entity, $langcode, $display_id);

Requirements

  • Drupal 10.2+ or 11.
  • Optional integrations are picked up automatically when installed: Views (view serialization), Field Group (nested groups), Block Field (block plugin serialization), Paragraphs (recursive paragraph walking).

Documentation

Full configuration reference, extension examples, the JSON contract, and recipes for typed frontends live in the project README.md in the repository.

Activity

Total releases
1
First release
Jun 2026
Latest release
1 day ago
Release cadence
Stability
100% stable

Releases

Version Type Release date
1.2.0 Stable Jun 1, 2026