Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Charts 5.2.4 Minor update available for module charts (5.2.4). Release: Tagify 2.0.3 Minor update available for module tagify (2.0.3). Release: Tagify 1.2.54 Minor update available for module tagify (1.2.54). Release: ECA: Event - Condition - Action 3.1.8 Minor update available for module eca (3.1.8). Release: GoogleTag Manager 2.0.5 Minor update available for module gtm (2.0.5). Release: GoogleTag Manager 2.0.4 Minor update available for module gtm (2.0.4). Release: X-Frame-Options Allow-From webvisor.com 2.0.4 Minor update available for module xframe_allow_webvisor (2.0.4). Release: Commerce ML Starter 2.0.5 Minor update available for module cmlstarter (2.0.5). Usage Milestone: Easy Email Module easy_email crossed 10,000 active installs. Security Coverage: Menu Link By Default Module menu_link_by_default now has official Drupal security advisory coverage.

REST Views

3,575 sites Security covered
View on drupal.org

This module enhances the REST Export display for Drupal Views, allowing for more flexible and accurate data serialization. It enables fields to be exported as arrays, nested structures for entity references, and proper JSON primitives for boolean and numeric types, addressing limitations of the default Views rendering.

REST Views

This module enhances the functionality of Views that use the REST Export display to export serialized data.

Introduction

When you create a view with a REST Export display, you will quickly encounter hard limitations on the data structure, imposed by the Views module's reliance on the Render API:

  • You may want to export a field with multiple values as an array. By default, this is only possible by exporting the raw field, as the rendering process also concatenates the output into a single string.

  • An entity reference can only be exported as a fully rendered string, and not as a nested structure with multiple individual fields.

  • Boolean and numeric fields can only be exported as strings, rather than the appropriate JSON primitives.

  • Contributed module exports (Such as paragraphs, geo field, and search api) require their respective sub modules to be enabled as well.

The Views and Field plugins in this module add all of these features.

Usage

After installing this module, each entity field can be accessed in Views via a new handler named "Field (Serializable)".

This field handler automatically exports multiple-value fields as arrays. This is dependent on the cardinality in the schema, so it will be applied even if the field contains less than two actual values.

Furthermore, the following fields will have new field formatters designed to export non-string values:

(Note that these will only work in combination with the Serializable handler.)

Nested entity references: In general these require a custom display mode where the fields are formatted with export formats unless you want rendered html. See the links below for specific discussions.

Extending

You can create your own field formatter plugins that export arbitrary data structures based on a field's values:

 $item) {
      $data = '[A data structure based on $item.]';
      $elements[$delta] = [
        '#type' => 'data',
        '#data' => SerializedData::create($data),
      ];
    }

    return $elements;
  }

}

Security

This module does not add any output filtering beyond that which has already been applied. In practice this means:

  • All fields with normal non-Export formatters (including those inside referenced entities) are rendered, and therefore contain safe HTML markup, provided their modules are working securely.
  • The Export field formatters export raw values.

If both kinds of formatters are used in the same view, clients should be made aware which values are markup and which are untreated strings. In all cases, the client application is responsible for safely using the exported data.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Jun 2026
Latest release
2 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
3.x-dev Dev 10–11 Jun 15, 2026