diff --git a/core/modules/rest/src/Plugin/views/row/DataFieldRow.php b/core/modules/rest/src/Plugin/views/row/DataFieldRow.php index 9b9e28573e..edccd279c9 100644 --- a/core/modules/rest/src/Plugin/views/row/DataFieldRow.php +++ b/core/modules/rest/src/Plugin/views/row/DataFieldRow.php @@ -152,7 +152,13 @@ public function render($row) { // Omit excluded fields from the rendered output. if (empty($field->options['exclude'])) { - $output[$this->getFieldKeyAlias($id)] = $value; + $raw_value = $field->getValue($row); + if (is_array($raw_value)) { + $raw_value = array_filter($raw_value); + } + if (empty($field->options['hide_empty']) || !empty($raw_value)) { + $output[$this->getFieldKeyAlias($id)] = $value; + } } }