diff --git a/core/modules/rest/src/Tests/NodeTest.php b/core/modules/rest/src/Tests/NodeTest.php
index 7169102..ece7810 100644
--- a/core/modules/rest/src/Tests/NodeTest.php
+++ b/core/modules/rest/src/Tests/NodeTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\rest\Tests;
 
 use Drupal\Core\Url;
+use Drupal\node\Entity\Node;
 use Drupal\rest\Tests\RESTTestBase;
 
 /**
@@ -90,4 +91,32 @@ public function testNodes() {
     // Make sure that the UUID of the node has not changed.
     $this->assertEqual($node->get('uuid')->getValue(), $updated_node->get('uuid')->getValue(), 'UUID was not changed.');
   }
+
+  /**
+   * Test creating a node using json serialization.
+   */
+  public function testCreate() {
+    // Test creating a node
+    // Check that a simple PATCH update to the node title works as expected.
+    $this->enableNodeConfiguration('POST', 'create');
+    $this->enableService('entity:node', 'POST', 'json');
+    $data = array(
+      'type' => array(
+        array(
+          'target_id' => 'resttest',
+        ),
+      ),
+      'title' => array(
+        array(
+          'value' => $this->randomString(),
+        ),
+      ),
+    );
+    $serialized = $this->container->get('serializer')->serialize($data, 'json');
+    $this->httpRequest('/entity/node', 'POST', $serialized, 'application/json');
+    $this->assertResponse(201);
+    $node = Node::load(1);
+    $this->assertHeader('Location', $node->url('canonical', ['absolute' => TRUE]));
+  }
+
 }
diff --git a/core/modules/serialization/src/Normalizer/EntityNormalizer.php b/core/modules/serialization/src/Normalizer/EntityNormalizer.php
index 5e81b5a..6580d32 100644
--- a/core/modules/serialization/src/Normalizer/EntityNormalizer.php
+++ b/core/modules/serialization/src/Normalizer/EntityNormalizer.php
@@ -8,6 +8,7 @@
 namespace Drupal\serialization\Normalizer;
 
 use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
 use Symfony\Component\Serializer\Exception\UnexpectedValueException;
 use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
 
@@ -43,22 +44,34 @@ public function __construct(EntityManagerInterface $entity_manager) {
   /**
    * {@inheritdoc}
    */
-  public function denormalize($data, $class, $format = NULL, array $context = array()) {
-    if (empty($context['entity_type'])) {
-      throw new UnexpectedValueException('Entity type parameter must be included in context.');
-    }
+  public function denormalize($data, $class, $format = NULL, array $context = []) {
+    // Get the entity type ID letting the context definition override the $class.
+    $entity_type_id = !empty($context['entity_type']) ? $context['entity_type']
+      : $this->entityManager->getEntityTypeFromClass($class);
+
+    /** @var \Drupal\Core\Entity\EntityTypeInterface $entity_type */
+    // Get the entity type definition.
+    $entity_type = $this->entityManager->getDefinition($entity_type_id);
 
-    $entity_type = $this->entityManager->getDefinition($context['entity_type']);
+    // Don't try to create an entity without an entity type id.
+    if (!$entity_type instanceof EntityTypeInterface) {
+      throw new UnexpectedValueException('A valid entity type is required for denormalization.');
+    }
 
-    // The bundle property behaves differently from other entity properties.
-    // i.e. the nested structure with a 'value' key does not work.
-    if ($entity_type->hasKey('bundle')) {
+    // The bundle property might be an entity reference and behaves differently
+    // from other entity properties. i.e. the nested structure with a 'value'
+    // key does not work.
+    if ($entity_type instanceof EntityTypeInterface && $entity_type->hasKey('bundle')) {
       $bundle_key = $entity_type->getKey('bundle');
-      $type = $data[$bundle_key][0]['value'];
-      $data[$bundle_key] = $type;
+      $data[$bundle_key] = !empty($data[$bundle_key][0]['target_id']) ? $data[$bundle_key][0]['target_id'] : $data[$bundle_key][0]['value'];
     }
 
-    return $this->entityManager->getStorage($context['entity_type'])->create($data);
-  }
+    // Create the entity from data.
+    $entity = $this->entityManager->getStorage($entity_type_id)->create($data);
+
+    // Pass the names of the fields whose values can be merged.
+    $entity->_restSubmittedFields = array_keys($data);
 
+    return $entity;
+  }
 }
