diff -u b/core/modules/rest/src/Plugin/views/display/RestExport.php b/core/modules/rest/src/Plugin/views/display/RestExport.php --- b/core/modules/rest/src/Plugin/views/display/RestExport.php +++ b/core/modules/rest/src/Plugin/views/display/RestExport.php @@ -284,7 +284,8 @@ $header = []; $header['Content-type'] = $this->getMimeType(); - $response = new CacheableResponse($this->renderer->renderRoot(SafeMarkup::set($output)), 200); + $output['#markup'] = SafeMarkup::set($output['#markup']); + $response = new CacheableResponse($this->renderer->renderRoot($output), 200); $cache_metadata = CacheableMetadata::createFromRenderArray($output); $response->addCacheableDependency($cache_metadata);