diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php
index 4684695..b355864 100644
--- a/core/lib/Drupal/Core/CoreBundle.php
+++ b/core/lib/Drupal/Core/CoreBundle.php
@@ -263,7 +263,7 @@ public function build(ContainerBuilder $container) {
     $container->register('serializer.normalizer.typed_data', 'Drupal\Core\Serialization\TypedDataNormalizer')->addTag('normalizer');
 
     $container->register('serializer.encoder.json', 'Drupal\Core\Serialization\JsonEncoder')
-      ->addTag('encoder', array('format' => array('json' => 'JSON')));
+      ->addTag('encoder', array('format' => array('json' => 'JSON', 'ajax' => 'AJAX')));
     $container->register('serializer.encoder.xml', 'Drupal\Core\Serialization\XmlEncoder')
       ->addTag('encoder', array('format' => array('xml' => 'XML')));
 
diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/views/style/Serializer.php b/core/modules/rest/lib/Drupal/rest/Plugin/views/style/Serializer.php
index 037534f..db9e4e9 100644
--- a/core/modules/rest/lib/Drupal/rest/Plugin/views/style/Serializer.php
+++ b/core/modules/rest/lib/Drupal/rest/Plugin/views/style/Serializer.php
@@ -46,13 +46,47 @@ class Serializer extends StylePluginBase {
   protected $serializer;
 
   /**
+   * The available serialization formats.
+   *
+   * @var array
+   */
+  protected $formats;
+
+  /**
    * Overrides \Drupal\views\Plugin\views\style\StylePluginBase::init().
    */
   public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
     parent::init($view, $display, $options);
 
+    $container = drupal_container();
     // Get the serializer service.
-    $this->serializer = drupal_container()->get('serializer');
+    $this->serializer = $container->get('serializer');
+    $this->formats = $container->getParameter('serializer.formats');
+  }
+
+  /**
+   * Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::defineOptions().
+   */
+  protected function defineOptions() {
+    $options = parent::defineOptions();
+    $options['formats'] = array('default' => array());
+
+    return $options;
+  }
+
+  /**
+   * Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::buildOptionsForm().
+   */
+  public function buildOptionsForm(&$form, &$form_state) {
+    parent::buildOptionsForm($form, $form_state);
+
+    $form['formats'] = array(
+      '#type' => 'checkboxes',
+      '#title' => t('Accepted request formats'),
+      '#description' => t('Request formats that will be allowed in responses. If none are selected all formats will be allowed.'),
+      '#options' => array_map('check_plain', $this->formats),
+      '#default_value' => $this->options['formats'],
+    );
   }
 
   /**
@@ -60,6 +94,13 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
    */
   public function render() {
     $rows = array();
+    $content_type = $this->displayHandler->getContentType();
+    $formats = array_filter($this->options['formats']);
+
+    if (empty($this->view->live_preview) && !empty($formats) && !in_array($content_type, $formats)) {
+      // @todo throw exception? Alter the response for the view?
+      return;
+    }
     // If the Data Entity row plugin is used, this will be an array of entities
     // which will pass through Serializer to one of the registered Normalizers,
     // which will transform it to arrays/scalars. If the Data field row plugin
@@ -69,7 +110,7 @@ public function render() {
       $rows[] = $this->row_plugin->render($row);
     }
 
-    return $this->serializer->serialize($rows, $this->displayHandler->getContentType());
+    return $this->serializer->serialize($rows, $content_type);
   }
 
 }
