diff --git a/core/composer.lock b/core/composer.lock
index 7d2a943..18db64d 100644
--- a/core/composer.lock
+++ b/core/composer.lock
@@ -811,18 +811,18 @@
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/Serializer",
-                "reference": "ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0"
+                "reference": "45fe843e3144a594f93a6a372385c6534c7df31c"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://github.com/symfony/Serializer/archive/ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0.zip",
-                "reference": "ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0",
+                "url": "https://github.com/symfony/Serializer/archive/45fe843e3144a594f93a6a372385c6534c7df31c.zip",
+                "reference": "45fe843e3144a594f93a6a372385c6534c7df31c",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.3.3"
             },
-            "time": "2012-12-19 07:09:49",
+            "time": "2013-01-19 07:50:02",
             "type": "library",
             "extra": {
                 "branch-alias": {
diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php
index bc6afef..3b49b71 100644
--- a/core/lib/Drupal/Core/CoreBundle.php
+++ b/core/lib/Drupal/Core/CoreBundle.php
@@ -11,7 +11,6 @@
 use Drupal\Core\DependencyInjection\Compiler\RegisterAccessChecksPass;
 use Drupal\Core\DependencyInjection\Compiler\RegisterMatchersPass;
 use Drupal\Core\DependencyInjection\Compiler\RegisterRouteFiltersPass;
-use Drupal\Core\DependencyInjection\Compiler\RegisterSerializationClassesPass;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\DependencyInjection\Reference;
@@ -245,17 +244,6 @@ public function build(ContainerBuilder $container) {
     $container
       ->register('transliteration', 'Drupal\Core\Transliteration\PHPTransliteration');
 
-    // Add Serializer with arguments to be replaced in the compiler pass.
-    $container->register('serializer', 'Symfony\Component\Serializer\Serializer')
-      ->addArgument(array())
-      ->addArgument(array());
-
-    $container->register('serializer.normalizer.complex_data', 'Drupal\Core\Serialization\ComplexDataNormalizer')->addTag('normalizer');
-    $container->register('serializer.normalizer.list', 'Drupal\Core\Serialization\ListNormalizer')->addTag('normalizer');
-    $container->register('serializer.normalizer.typed_data', 'Drupal\Core\Serialization\TypedDataNormalizer')->addTag('normalizer');
-    $container->register('serializer.encoder.json', 'Drupal\Core\Serialization\JsonEncoder')->addTag('encoder');
-    $container->register('serializer.encoder.xml', 'Drupal\Core\Serialization\XmlEncoder')->addTag('encoder');
-
     $container->register('flood', 'Drupal\Core\Flood\DatabaseBackend')
       ->addArgument(new Reference('database'));
 
@@ -263,8 +251,6 @@ public function build(ContainerBuilder $container) {
     $container->addCompilerPass(new RegisterRouteFiltersPass());
     // Add a compiler pass for registering event subscribers.
     $container->addCompilerPass(new RegisterKernelListenersPass(), PassConfig::TYPE_AFTER_REMOVING);
-    // Add a compiler pass for adding Normalizers and Encoders to Serializer.
-    $container->addCompilerPass(new RegisterSerializationClassesPass());
     // Add a compiler pass for registering event subscribers.
     $container->addCompilerPass(new RegisterKernelListenersPass(), PassConfig::TYPE_AFTER_REMOVING);
     $container->addCompilerPass(new RegisterAccessChecksPass());
diff --git a/core/lib/Drupal/Core/Serialization/ComplexDataNormalizer.php b/core/lib/Drupal/Core/Serialization/ComplexDataNormalizer.php
index 06a5415..642352d 100644
--- a/core/lib/Drupal/Core/Serialization/ComplexDataNormalizer.php
+++ b/core/lib/Drupal/Core/Serialization/ComplexDataNormalizer.php
@@ -32,7 +32,7 @@ class ComplexDataNormalizer extends NormalizerBase {
   /**
    * Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize().
    */
-  public function normalize($object, $format = NULL) {
+  public function normalize($object, $format = NULL, array $context = array()) {
     $attributes = array();
     foreach ($object as $name => $field) {
       $attributes[$name] = $this->serializer->normalize($field, $format);
diff --git a/core/lib/Drupal/Core/Serialization/ListNormalizer.php b/core/lib/Drupal/Core/Serialization/ListNormalizer.php
index ee20fb6..d590b7b 100644
--- a/core/lib/Drupal/Core/Serialization/ListNormalizer.php
+++ b/core/lib/Drupal/Core/Serialization/ListNormalizer.php
@@ -31,7 +31,7 @@ class ListNormalizer extends NormalizerBase {
   /**
    * Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize().
    */
-  public function normalize($object, $format = NULL) {
+  public function normalize($object, $format = NULL, array $context = array()) {
     $attributes = array();
     foreach ($object as $fieldItem) {
       $attributes[] = $this->serializer->normalize($fieldItem, $format);
diff --git a/core/lib/Drupal/Core/Serialization/NormalizerBase.php b/core/lib/Drupal/Core/Serialization/NormalizerBase.php
index f256b0e..5b370a6 100644
--- a/core/lib/Drupal/Core/Serialization/NormalizerBase.php
+++ b/core/lib/Drupal/Core/Serialization/NormalizerBase.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\Core\Serialization;
 
-use Drupal\Core\Entity\EntityInterface;
+use Drupal\serialization\Plugin\Type\EntityReferenceHandlerPluginManager;
 use Symfony\Component\Serializer\Exception\RuntimeException;
 use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
 use Symfony\Component\Serializer\Normalizer\SerializerAwareNormalizer;
@@ -24,6 +24,8 @@
    */
   protected static $supportedInterfaceOrClass;
 
+  protected $entityReferenceHandlerPluginManager;
+
   /**
    * Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::supportsNormalization().
    */
@@ -31,4 +33,8 @@ public function supportsNormalization($data, $format = NULL) {
     return is_object($data) && ($data instanceof static::$supportedInterfaceOrClass);
   }
 
+  public function setEntityReferenceHandlerPluginManager(EntityReferenceHandlerPluginManager $plugin_manager) {
+    $this->entityReferenceHandlerPluginManager = $plugin_manager;
+  }
+
 }
diff --git a/core/lib/Drupal/Core/Serialization/TypedDataNormalizer.php b/core/lib/Drupal/Core/Serialization/TypedDataNormalizer.php
index 0376771..cf2a879 100644
--- a/core/lib/Drupal/Core/Serialization/TypedDataNormalizer.php
+++ b/core/lib/Drupal/Core/Serialization/TypedDataNormalizer.php
@@ -25,7 +25,7 @@ class TypedDataNormalizer extends NormalizerBase {
   /**
    * Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize().
    */
-  public function normalize($object, $format = NULL) {
+  public function normalize($object, $format = NULL, array $context = array()) {
     return $object->getValue();
   }
 
diff --git a/core/lib/Drupal/Core/Serialization/XmlEncoder.php b/core/lib/Drupal/Core/Serialization/XmlEncoder.php
index 7235af3..f2ab49e 100644
--- a/core/lib/Drupal/Core/Serialization/XmlEncoder.php
+++ b/core/lib/Drupal/Core/Serialization/XmlEncoder.php
@@ -44,7 +44,7 @@ public function __construct() {
   /**
    * Implements \Symfony\Component\Serializer\Encoder\EncoderInterface::encode().
    */
-  public function encode($data, $format){
+  public function encode($data, $format, array $context=array()){
     $normalized = $this->serializer->normalize($data, $format);
     return $this->baseEncoder->encode($normalized, $format);
   }
@@ -59,7 +59,7 @@ public function supportsEncoding($format) {
   /**
    * Implements \Symfony\Component\Serializer\Encoder\EncoderInterface::decode().
    */
-  public function decode($data, $format){
+  public function decode($data, $format, array $context=array()){
     return $this->baseEncoder->decode($data, $format);
   }
 
diff --git a/core/modules/jsonld/jsonld.info b/core/modules/jsonld/jsonld.info
index fce4688..6e89779 100644
--- a/core/modules/jsonld/jsonld.info
+++ b/core/modules/jsonld/jsonld.info
@@ -4,3 +4,4 @@ package = Core
 version = VERSION
 core = 8.x
 dependencies[] = rdf
+dependencies[] = serialization
diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldBundle.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldBundle.php
index 6aa69ec..63d853d 100644
--- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldBundle.php
+++ b/core/modules/jsonld/lib/Drupal/jsonld/JsonldBundle.php
@@ -51,6 +51,7 @@ public function build(ContainerBuilder $container) {
         $container->register("serializer.normalizer.{$supported_class}.{$format}", $normalizer_class)
           ->addArgument(new Reference('rdf.site_schema_manager'))
           ->addArgument(new Reference('rdf.mapping_manager'))
+          ->addMethodCall('setEntityReferenceHandlerPluginManager', array(new Reference('plugin.manager.serialization.entityreference_handler')))
           ->addTag('normalizer', array('priority' => $priority));
       }
     }
diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityNormalizer.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityNormalizer.php
index b286539..f2c28d7 100644
--- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityNormalizer.php
+++ b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityNormalizer.php
@@ -8,6 +8,7 @@
 namespace Drupal\jsonld;
 
 use Drupal\jsonld\JsonldNormalizerBase;
+use Drupal\serialization\Plugin\Type\EntityReferenceHandlerPluginManager;
 use Drupal\rdf\RdfMappingException;
 use Symfony\Component\Serializer\Exception\UnexpectedValueException;
 use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
@@ -27,7 +28,7 @@ class JsonldEntityNormalizer extends JsonldNormalizerBase implements Denormalize
   /**
    * Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize()
    */
-  public function normalize($entity, $format = NULL) {
+  public function normalize($entity, $format = NULL, array $context = array()) {
     $entity_wrapper = new JsonldEntityWrapper($entity, $format, $this->serializer, $this->siteSchemaManager);
 
     $attributes = $entity_wrapper->getProperties();
@@ -43,7 +44,7 @@ public function normalize($entity, $format = NULL) {
    *
    * @throws \Symfony\Component\Serializer\Exception\UnexpectedValueException
    */
-  public function denormalize($data, $class, $format = null) {
+  public function denormalize($data, $class, $format = NULL, array $context = array()) {
     if (!isset($data['@type'])) {
       throw new UnexpectedValueException('JSON-LD @type parameter must be included.');
     }
@@ -88,6 +89,7 @@ public function denormalize($data, $class, $format = null) {
       }
     }
 
+    $entityreference_settings = serialization_get_entityreference_deserialize_settings($entity->entityType(), $entity->bundle(), $format);
     // For each attribute in the JSON-LD, add the values as fields to the newly
     // created entity. It is assumed that the JSON attribute names are the same
     // as the site's field names.
@@ -112,7 +114,11 @@ public function denormalize($data, $class, $format = null) {
       // The vnd.drupal.ld+json mime type will always use language keys, per
       // http://drupal.org/node/1838700.
       foreach ($incomingFieldValues as $langcode => $incomingFieldItems) {
-        $fieldValue = $this->serializer->denormalize($incomingFieldItems, $fieldItemClass, $format);
+        $context = array();
+        if ($plugin_id = $entityreference_settings->getHandler($fieldName)) {
+          $context['entityreference_handler'] = $this->entityReferenceHandlerPluginManager->createInstance($plugin_id);
+        }
+        $fieldValue = $this->serializer->denormalize($incomingFieldItems, $fieldItemClass, $format, $context);
         $entity->getTranslation($langcode)
           ->set($fieldName, $fieldValue);
       }
diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityReferenceNormalizer.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityReferenceNormalizer.php
index 66767cf..28216f6 100644
--- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityReferenceNormalizer.php
+++ b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityReferenceNormalizer.php
@@ -30,8 +30,8 @@ class JsonldEntityReferenceNormalizer extends JsonldNormalizerBase implements De
   /**
    * Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize()
    */
-  public function normalize($object, $format = NULL) {
-    // @todo If an $options parameter is added to the serialize signature, as
+  public function normalize($object, $format = null, array $context = array()) {
+    // @todo Since the context parameter was added to Serilizer's interface, as
     // requested in https://github.com/symfony/symfony/pull/4938, then instead
     // of creating the array of properties, we could simply call normalize and
     // pass in the referenced entity with a flag that ensures it is rendered as
@@ -45,9 +45,14 @@ public function normalize($object, $format = NULL) {
   /**
    * Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::denormalize()
    */
-  public function denormalize($data, $class, $format = null) {
-    // @todo Support denormalization for Entity Reference.
-    return array();
+  public function denormalize($data, $class, $format = null, array $context = array()) {
+    $return = array();
+    $entityreference_handler = $context['entityreference_handler'];
+
+    foreach ($data as $node) {
+      $return[]['value'] = $entityreference_handler->getEntityId();
+    }
+    return $return;
   }
 
   /**
diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldFieldItemNormalizer.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldFieldItemNormalizer.php
index bf421a1..7e3d124 100644
--- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldFieldItemNormalizer.php
+++ b/core/modules/jsonld/lib/Drupal/jsonld/JsonldFieldItemNormalizer.php
@@ -27,14 +27,14 @@ class JsonldFieldItemNormalizer extends JsonldNormalizerBase implements Denormal
   /**
    * Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize()
    */
-  public function normalize($object, $format = NULL) {
+  public function normalize($object, $format = NULL, array $context = array()) {
     return $object->getPropertyValues();
   }
 
   /**
    * Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::denormalize()
    */
-  public function denormalize($data, $class, $format = null) {
+  public function denormalize($data, $class, $format = null, array $context = array()) {
     // For most fields, the field items array should simply be returned as is.
     return $data;
   }
diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldNormalizerBase.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldNormalizerBase.php
index e898da8..74b2111 100644
--- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldNormalizerBase.php
+++ b/core/modules/jsonld/lib/Drupal/jsonld/JsonldNormalizerBase.php
@@ -8,6 +8,7 @@
 namespace Drupal\jsonld;
 
 use ReflectionClass;
+use Drupal\Core\Serialization\NormalizerBase;
 use Drupal\rdf\RdfMappingManager;
 use Drupal\rdf\SiteSchema\SiteSchemaManager;
 use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
@@ -16,14 +17,7 @@
 /**
  * Provide a base class for JSON-LD Normalizers.
  */
-abstract class JsonldNormalizerBase extends SerializerAwareNormalizer implements NormalizerInterface {
-
-  /**
-   * The interface or class that this Normalizer supports.
-   *
-   * @var string
-   */
-  protected static $supportedInterfaceOrClass;
+abstract class JsonldNormalizerBase extends NormalizerBase {
 
   /**
    * The formats that this Normalizer supports.
@@ -60,7 +54,7 @@ public function __construct(SiteSchemaManager $site_schema_manager, RdfMappingMa
   }
 
   /**
-   * Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize()
+   * Overrides \Drupal\Core\Serialization\NormalizerBase::supportsNormalization()
    */
   public function supportsNormalization($data, $format = NULL) {
     return is_object($data) && in_array($format, static::$format) && ($data instanceof static::$supportedInterfaceOrClass);
diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldRdfSchemaNormalizer.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldRdfSchemaNormalizer.php
index 2834c61..9c63332 100644
--- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldRdfSchemaNormalizer.php
+++ b/core/modules/jsonld/lib/Drupal/jsonld/JsonldRdfSchemaNormalizer.php
@@ -25,7 +25,7 @@ class JsonldRdfSchemaNormalizer extends JsonldNormalizerBase {
   /**
     * Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize()
     */
-  public function normalize($data, $format = NULL) {
+  public function normalize($data, $format = NULL, array $context = array()) {
     $normalized = array();
     $graph = $data->getGraph();
 
diff --git a/core/modules/jsonld/lib/Drupal/jsonld/Tests/JsonldTestSetupHelper.php b/core/modules/jsonld/lib/Drupal/jsonld/Tests/JsonldTestSetupHelper.php
index d0eb0c3..5ddf281 100644
--- a/core/modules/jsonld/lib/Drupal/jsonld/Tests/JsonldTestSetupHelper.php
+++ b/core/modules/jsonld/lib/Drupal/jsonld/Tests/JsonldTestSetupHelper.php
@@ -15,6 +15,7 @@
 use Drupal\rdf\RdfMappingManager;
 use Drupal\rdf\EventSubscriber\MappingSubscriber;
 use Drupal\rdf\SiteSchema\SiteSchemaManager;
+use Drupal\serialization\Plugin\Type\EntityReferenceHandlerPluginManager;
 use Symfony\Component\EventDispatcher\EventDispatcher;
 use Symfony\Component\Serializer\Serializer;
 
@@ -45,6 +46,13 @@ class JsonldTestSetupHelper {
   protected $normalizers;
 
   /**
+   * The Serializer.
+   *
+   * @var \Symfony\Component\Serializer\Serializer
+   */
+  protected $serializer;
+
+  /**
    * Constructor.
    */
   public function __construct() {
@@ -60,8 +68,10 @@ public function __construct() {
       'field_item' => new JsonldFieldItemNormalizer($this->siteSchemaManager, $this->rdfMappingManager),
       'entity' => new JsonldEntityNormalizer($this->siteSchemaManager, $this->rdfMappingManager),
     );
-    $serializer = new Serializer($this->normalizers, array(new JsonldEncoder()));
-    $this->normalizers['entity']->setSerializer($serializer);
+    $this->serializer = new Serializer($this->normalizers, array(new JsonldEncoder()));
+    $this->normalizers['entity']->setSerializer($this->serializer);
+    $this->normalizers['entity']->setEntityReferenceHandlerPluginManager(new EntityReferenceHandlerPluginManager());
+
   }
 
   /**
@@ -75,6 +85,16 @@ public function getNormalizers() {
   }
 
   /**
+   * Get Serializer.
+   *
+   * @return \Symfony\Component\Serializer\Serializer
+   *   The serializer.
+   */
+  public function getSerializer() {
+    return $this->serializer;
+  }
+
+  /**
    * Get the SiteSchemaManager object.
    *
    * @return \Drupal\rdf\SiteSchema\SiteSchemaManager
diff --git a/core/modules/jsonld/lib/Drupal/jsonld/Tests/NormalizeDenormalizeTest.php b/core/modules/jsonld/lib/Drupal/jsonld/Tests/NormalizeDenormalizeTest.php
index a9e057d..db76ea2 100644
--- a/core/modules/jsonld/lib/Drupal/jsonld/Tests/NormalizeDenormalizeTest.php
+++ b/core/modules/jsonld/lib/Drupal/jsonld/Tests/NormalizeDenormalizeTest.php
@@ -145,6 +145,13 @@ function testDenormalize() {
     $bundle_uri = $schema->bundle('entity_test', 'entity_test')->getUri();
     $incoming_data = array(
       '@type' => $bundle_uri,
+      'user_id' => array(
+        'de' => array(
+          array(
+            '@id' => 'http://example.com/user/foo',
+          ),
+        ),
+      ),
       'name' => array(
         'en' => array(
           array(
@@ -167,12 +174,26 @@ function testDenormalize() {
       ),
     );
 
+    // Set the entity reference handlers for entity reference fields.
+    $values = array(
+      'targetEntityType' => 'entity_test',
+      'bundle' => 'entity_test',
+      'format' => static::$format,
+    );
+    $config = entity_create('entityreference_deserialize_settings', $values);
+    $config->setHandler('user_id', 'configured_value');
+    $config->save();
+
     // Test valid request.
     $entity = $this->normalizers['entity']->denormalize($incoming_data, 'Drupal\Core\Entity\EntityNG', static::$format);
     $this->assertEqual('entity_test', $entity->bundle(), "Denormalize creates entity with correct bundle.");
     $this->assertEqual($incoming_data['name']['en'], $entity->get('name')->getValue(), "Translatable field denormalized correctly in default language.");
     $this->assertEqual($incoming_data['name']['de'], $entity->getTranslation('de')->get('name')->getValue(), "Translatable field denormalized correctly in translation language.");
     $this->assertEqual($incoming_data['field_test_text']['und'], $entity->get('field_test_text')->getValue(), "Untranslatable field denormalized correctly.");
+    // For now, we just test that the user_id is equal to one.
+    // @todo Fix this once configured_value entity reference handler is
+    // enhanced.
+    $this->assertEqual(array(array('value' => 1)), $entity->getTranslation('de')->get('user_id')->getValue(), "Entity reference field denormalized correctly.");
 
     // Test request without @type.
     unset($incoming_data['@type']);
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php b/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php
index b47f296..d5fb8de 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\rest\Tests;
 
+use Drupal\jsonld\Tests\JsonldTestSetupHelper;
 use Drupal\rest\Tests\RESTTestBase;
 
 /**
@@ -33,12 +34,16 @@ public static function getInfo() {
    * Tests several valid and invalid create requests on all entity types.
    */
   public function testCreate() {
-    $serializer = drupal_container()->get('serializer');
+    // Get the mock Serializer.
+    $jsonld_setup_helper = new JsonldTestSetupHelper();
+    $serializer = $jsonld_setup_helper->getSerializer();
+
     // @todo once EntityNG is implemented for other entity types test all other
     // entity types here as well.
     $entity_type = 'entity_test';
 
     $this->enableService('entity:' . $entity_type);
+    $this->setupEntityReferenceHandlers();
     // Create a user account that has the required permissions to create
     // resources via the web API.
     $account = $this->drupalCreateUser(array('restful post entity:' . $entity_type));
@@ -59,9 +64,6 @@ public function testCreate() {
     $loaded_entity = entity_load($entity_type, $id);
     $this->assertNotIdentical(FALSE, $loaded_entity, 'The new ' . $entity_type . ' was found in the database.');
     $this->assertEqual($entity->uuid(), $loaded_entity->uuid(), 'UUID of created entity is correct.');
-    // @todo Remove the user reference field for now until deserialization for
-    // entity references is implemented.
-    unset($entity_values['user_id']);
     foreach ($entity_values as $property => $value) {
       $actual_value = $loaded_entity->get($property)->value;
       $send_value = $entity->get($property)->value;
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php b/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php
index 3036977..260bc3e 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php
@@ -153,6 +153,21 @@ protected function entityValues($entity_type) {
   }
 
   /**
+   * Saves configuration for entity reference handlers for deserialization.
+   */
+  protected function setupEntityReferenceHandlers() {
+    // Set up the Entity Reference Handler for user_id field.
+    $values = array(
+      'targetEntityType' => 'entity_test',
+      'bundle' => 'entity_test',
+      'format' => 'drupal_jsonld',
+    );
+    $config = entity_create('entityreference_deserialize_settings', $values);
+    $config->setHandler('user_id', 'configured_value');
+    $config->save();
+  }
+
+  /**
    * Enables the web service interface for a specific entity type.
    *
    * @param string|FALSE $resource_type
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php b/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
index 83729aa..a680aca 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\rest\Tests;
 
+use Drupal\jsonld\Tests\JsonldTestSetupHelper;
 use Drupal\rest\Tests\RESTTestBase;
 
 /**
@@ -33,12 +34,15 @@ public static function getInfo() {
    * Tests several valid and invalid partial update requests on test entities.
    */
   public function testPatchUpdate() {
-    $serializer = drupal_container()->get('serializer');
+    // Get the mock Serializer.
+    $jsonld_setup_helper = new JsonldTestSetupHelper();
+    $serializer = $jsonld_setup_helper->getSerializer();
     // @todo once EntityNG is implemented for other entity types test all other
     // entity types here as well.
     $entity_type = 'entity_test';
 
     $this->enableService('entity:' . $entity_type);
+    $this->setupEntityReferenceHandlers();
     // Create a user account that has the required permissions to create
     // resources via the web API.
     $account = $this->drupalCreateUser(array('restful patch entity:' . $entity_type));
@@ -101,12 +105,15 @@ public function testPatchUpdate() {
    * Tests several valid and invalid PUT update requests on test entities.
    */
   public function testPutUpdate() {
-    $serializer = drupal_container()->get('serializer');
+    // Get the mock Serializer.
+    $jsonld_setup_helper = new JsonldTestSetupHelper();
+    $serializer = $jsonld_setup_helper->getSerializer();
     // @todo once EntityNG is implemented for other entity types test all other
     // entity types here as well.
     $entity_type = 'entity_test';
 
     $this->enableService('entity:' . $entity_type);
+    $this->setupEntityReferenceHandlers();
     // Create a user account that has the required permissions to create
     // resources via the web API.
     $account = $this->drupalCreateUser(array('restful put entity:' . $entity_type));
@@ -130,9 +137,6 @@ public function testPutUpdate() {
 
     // Re-load the updated entity from the database.
     $entity = entity_load($entity_type, $entity->id(), TRUE);
-    // @todo Don't check the user reference field for now until deserialization
-    // for entity references is implemented.
-    unset($update_values['user_id']);
     foreach ($update_values as $property => $value) {
       $update_value = $update_entity->{$property}->value;
       $stored_value = $entity->{$property}->value;
diff --git a/core/modules/rest/rest.info b/core/modules/rest/rest.info
index c0bf4bd..c450567 100644
--- a/core/modules/rest/rest.info
+++ b/core/modules/rest/rest.info
@@ -5,4 +5,5 @@ version = VERSION
 core = 8.x
 ; @todo Remove this dependency once hard coding to JSON-LD is gone.
 dependencies[] = jsonld
+dependencies[] = serialization
 configure = admin/config/services/rest
diff --git a/core/modules/serialization/lib/Drupal/serialization/Plugin/Core/Entity/EntityReferenceDeserializeSettings.php b/core/modules/serialization/lib/Drupal/serialization/Plugin/Core/Entity/EntityReferenceDeserializeSettings.php
new file mode 100644
index 0000000..fd872b8
--- /dev/null
+++ b/core/modules/serialization/lib/Drupal/serialization/Plugin/Core/Entity/EntityReferenceDeserializeSettings.php
@@ -0,0 +1,119 @@
+<?php
+/**
+ * @file
+ * Contains Drupal/serialization/Plugin/Core/Entity/EntityReferenceDeserializeSettings
+ */
+
+namespace Drupal\serialization\Plugin\Core\Entity;
+
+use Drupal\Core\Config\Entity\ConfigEntityBase;
+use Drupal\Core\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+
+/**
+ * Configuration entity that contains display options for all components of a
+ * rendered entity in a given view mode..
+ *
+ * @Plugin(
+ *   id = "entityreference_deserialize_settings",
+ *   label = @Translation("Entity reference deserialize settings"),
+ *   module = "entity",
+ *   controller_class = "Drupal\Core\Config\Entity\ConfigStorageController",
+ *   config_prefix = "serialization.entityreference",
+ *   entity_keys = {
+ *     "id" = "id",
+ *     "uuid" = "uuid"
+ *   }
+ * )
+ */
+class EntityReferenceDeserializeSettings extends ConfigEntityBase {
+
+  /**
+   * Unique ID for the config entity.
+   *
+   * @var string
+   */
+  public $id;
+
+  /**
+   * Unique UUID for the config entity.
+   *
+   * @var string
+   */
+  public $uuid;
+
+  /**
+   * Entity type to be deserialized.
+   *
+   * @var string
+   */
+  public $targetEntityType;
+
+  /**
+   * Bundle to be deserialized.
+   *
+   * @var string
+   */
+  public $bundle;
+
+  /**
+   * The short name of the serialization format.
+   *
+   * @var string
+   */
+  public $format;
+
+  /**
+   * List of entity reference field handlers, keyed by format and field name.
+   *
+   * @var array
+   */
+  public $entityreferenceHandlers = array();
+
+  /**
+   * Overrides \Drupal\Core\Entity\Entity::id().
+   */
+  public function id() {
+    return $this->targetEntityType . '.' . $this->bundle . '.' . $this->format;
+  }
+
+  /**
+   * Overrides \Drupal\config\ConfigEntityBase::save().
+   */
+  public function save() {
+    // Build an ID if none is set.
+    if (empty($this->id)) {
+      $this->id = $this->id();
+    }
+    return parent::save();
+  }
+
+  /**
+   * Sets the Entity Reference Handler to use when deserializing this field.
+   *
+   * @param $field_name
+   *   Name of the field which the handler will handle.
+   * @param $handler_name
+   *   The plugin id of the handler.
+   */
+  public function setHandler($field_name, $handler_name) {
+    $this->entityreferenceHandlers[$field_name] = $handler_name;
+  }
+
+  /**
+   * Gets the Entity Reference Handler to use when deserializing this field.
+   *
+   * @param $field_name
+   *   Name of the field which the handler will handle.
+   *
+   * @return string
+   *   The plugin id of the handler.
+   */
+  public function getHandler($field_name) {
+    if (isset($this->entityreferenceHandlers[$field_name])) {
+      return $this->entityreferenceHandlers[$field_name];
+    }
+    return FALSE;
+  }
+
+}
diff --git a/core/modules/serialization/lib/Drupal/serialization/Plugin/Type/EntityReferenceHandlerPluginManager.php b/core/modules/serialization/lib/Drupal/serialization/Plugin/Type/EntityReferenceHandlerPluginManager.php
new file mode 100644
index 0000000..02a01f2
--- /dev/null
+++ b/core/modules/serialization/lib/Drupal/serialization/Plugin/Type/EntityReferenceHandlerPluginManager.php
@@ -0,0 +1,26 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal/serialization/Plugin/Type/EntityReferenceHandlerPluginManager
+ */
+
+namespace Drupal\serialization\Plugin\Type;
+
+use Drupal\Component\Plugin\PluginManagerBase;
+use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+use Drupal\Component\Plugin\Factory\DefaultFactory;
+
+/**
+ * Defines the plugin manager for Entity Reference Handler plugins.
+ */
+class EntityReferenceHandlerPluginManager extends PluginManagerBase {
+
+  /**
+   * Overrides Drupal\Component\Plugin\PluginManagerBase::__construct().
+   */
+  public function __construct() {
+    $this->discovery = new AnnotatedClassDiscovery('serialization', 'entityreference_handler');
+    $this->factory = new DefaultFactory($this);
+  }
+}
diff --git a/core/modules/serialization/lib/Drupal/serialization/Plugin/serialization/entityreference_handler/ConfiguredValue.php b/core/modules/serialization/lib/Drupal/serialization/Plugin/serialization/entityreference_handler/ConfiguredValue.php
new file mode 100644
index 0000000..46e9d4c
--- /dev/null
+++ b/core/modules/serialization/lib/Drupal/serialization/Plugin/serialization/entityreference_handler/ConfiguredValue.php
@@ -0,0 +1,28 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal/rest/Plugin/rest/entityreference_handler/ConfiguredValue
+ */
+
+namespace Drupal\serialization\Plugin\serialization\entityreference_handler;
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+
+/**
+ * Provides an entity reference handler for using a configured value.
+ *
+ * @Plugin(
+ *   id = "configured_value",
+ *   label = @Translation("URI Dereference")
+ * )
+ */
+class ConfiguredValue {
+  public function getEntityId() {
+    // For now, the only entity reference field is user_id, and the only user
+    // guaranteed to be available is user 1, so set this to user one.
+    // @todo Make this configurable via the UI.
+    return 1;
+  }
+}
diff --git a/core/modules/serialization/lib/Drupal/serialization/Plugin/serialization/entityreference_handler/UriDereference.php b/core/modules/serialization/lib/Drupal/serialization/Plugin/serialization/entityreference_handler/UriDereference.php
new file mode 100644
index 0000000..91f3aa5
--- /dev/null
+++ b/core/modules/serialization/lib/Drupal/serialization/Plugin/serialization/entityreference_handler/UriDereference.php
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal/rest/Plugin/rest/entityreference_handler/UriDereference
+ */
+
+namespace Drupal\serialization\Plugin\serialization\entityreference_handler;
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+
+/**
+ * Provides an entity reference handler for dereferencing URIs.
+ *
+ * @Plugin(
+ *   id = "uri_dereference",
+ *   label = @Translation("URI Dereference")
+ * )
+ */
+class UriDereference {
+  public function getEntityId() {
+
+  }
+
+  protected function request() {
+
+  }
+}
diff --git a/core/modules/serialization/lib/Drupal/serialization/SerializationBundle.php b/core/modules/serialization/lib/Drupal/serialization/SerializationBundle.php
new file mode 100644
index 0000000..e610fc3
--- /dev/null
+++ b/core/modules/serialization/lib/Drupal/serialization/SerializationBundle.php
@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal\rest\SerializationBundle.
+ */
+
+namespace Drupal\serialization;
+
+use Drupal\Core\DependencyInjection\Compiler\RegisterSerializationClassesPass;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\HttpKernel\Bundle\Bundle;
+
+/**
+ * Serialization dependency injection container.
+ */
+class SerializationBundle extends Bundle {
+
+  /**
+   * Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
+   */
+  public function build(ContainerBuilder $container) {
+    // Register the entity reference handler plugin manager class.
+    $container->register('plugin.manager.serialization.entityreference_handler', 'Drupal\serialization\Plugin\Type\EntityReferenceHandlerPluginManager');
+    // Add Serializer with arguments to be replaced in the compiler pass.
+    $container->register('serializer', 'Symfony\Component\Serializer\Serializer')
+      ->addArgument(array())
+      ->addArgument(array());
+
+    $container->register('serializer.normalizer.complex_data', 'Drupal\Core\Serialization\ComplexDataNormalizer')->addTag('normalizer');
+    $container->register('serializer.normalizer.list', 'Drupal\Core\Serialization\ListNormalizer')->addTag('normalizer');
+    $container->register('serializer.normalizer.typed_data', 'Drupal\Core\Serialization\TypedDataNormalizer')->addTag('normalizer');
+    $container->register('serializer.encoder.json', 'Drupal\Core\Serialization\JsonEncoder')->addTag('encoder');
+    $container->register('serializer.encoder.xml', 'Drupal\Core\Serialization\XmlEncoder')->addTag('encoder');
+
+    // Add a compiler pass for adding Normalizers and Encoders to Serializer.
+    $container->addCompilerPass(new RegisterSerializationClassesPass());
+  }
+}
diff --git a/core/modules/serialization/lib/Drupal/serialization/Tests/EntityReferenceDeserializeSettingsTest.php b/core/modules/serialization/lib/Drupal/serialization/Tests/EntityReferenceDeserializeSettingsTest.php
new file mode 100644
index 0000000..60b8a82
--- /dev/null
+++ b/core/modules/serialization/lib/Drupal/serialization/Tests/EntityReferenceDeserializeSettingsTest.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal\serialization\Tests\EntityReferenceDeserializeSettingsTest
+ */
+
+namespace Drupal\serialization\Tests;
+
+use Drupal\serialization\Plugin\serialization\entityreference_handler\ConfiguredValue;
+use Drupal\simpletest\DrupalUnitTestBase;
+
+class EntityReferenceDeserializeSettingsTest extends DrupalUnitTestBase {
+
+  public static $modules = array('entity', 'serialization');
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Entity Reference Deserialize Settings Test',
+      'description' => "Tests the Entity Reference Deserialize Settings config object.",
+      'group' => 'Serialization',
+    );
+  }
+
+  public function testSetGet() {
+    $values = array(
+      'targetEntityType' => 'entity_test',
+      'bundle' => 'entity_test',
+      'format' => 'drupal_jsonld',
+    );
+    $id = implode('.', $values);
+    $config = entity_create('entityreference_deserialize_settings', $values);
+    $config->setHandler('user_id', 'configured_value');
+    $config->save();
+
+    $loadedConfig = entity_load('entityreference_deserialize_settings', $id);
+    // Test that setHandler works.
+    $expected= array (
+      'user_id' => 'configured_value',
+    );
+    $this->assertEqual($expected, $loadedConfig->get('entityreferenceHandlers'), 'setHandler() sets the appropriate handler.');
+
+    // Test that getHandler works.
+    $handler = $loadedConfig->getHandler('user_id');
+    $this->assertTrue($handler == 'configured_value', 'getHandler() returns the handler name.');
+  }
+}
diff --git a/core/modules/serialization/serialization.info b/core/modules/serialization/serialization.info
new file mode 100644
index 0000000..9ae7649
--- /dev/null
+++ b/core/modules/serialization/serialization.info
@@ -0,0 +1,4 @@
+name = Serialization
+description = Provides a service for (de)serializing data to/from formats such as JSON and XML
+package = Core
+core = 8.x
diff --git a/core/modules/serialization/serialization.module b/core/modules/serialization/serialization.module
new file mode 100644
index 0000000..4d90be8
--- /dev/null
+++ b/core/modules/serialization/serialization.module
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * @file
+ * Manage the serialization system.
+ *
+ * The module is mostly an anchor point for configuration items owned by the
+ * serialization system.
+ */
+
+/**
+ * Get the entity reference deserialize settings for a bundle in a format.
+ *
+ * @param $entity_type
+ *   The entity type of the bundle.
+ * @param $bundle
+ *   The bundle.
+ * @param $format
+ *   The format of the data being deserialzed.
+ *
+ * @return Drupal\serialization\Plugin\Core\Entity\EntityReferenceDeserializeSettings
+ *   The config object.
+ */
+function serialization_get_entityreference_deserialize_settings($entity_type, $bundle, $format) {
+  // Try loading the settings from configuration.
+  $settings = entity_load('entityreference_deserialize_settings', $entity_type . '.' . $bundle . '.' . $format);
+
+  // If not found, create a fresh config object.
+  if (!$settings) {
+    $settings = entity_create('entityreference_deserialize_settings', array(
+      'targetEntityType' => $entity_type,
+      'bundle' => $bundle,
+      'format' => $format,
+    ));
+  }
+
+  return $settings;
+}
\ No newline at end of file
diff --git a/core/modules/system/tests/modules/serialization_test/lib/Drupal/serialization_test/SerializationTestEncoder.php b/core/modules/system/tests/modules/serialization_test/lib/Drupal/serialization_test/SerializationTestEncoder.php
index bf1a755..ad3d323 100644
--- a/core/modules/system/tests/modules/serialization_test/lib/Drupal/serialization_test/SerializationTestEncoder.php
+++ b/core/modules/system/tests/modules/serialization_test/lib/Drupal/serialization_test/SerializationTestEncoder.php
@@ -19,29 +19,15 @@ class SerializationTestEncoder implements EncoderInterface {
   static protected $format = 'serialization_test';
 
   /**
-   * Encodes data into the requested format.
-   *
-   * @param mixed $data
-   *   Data to encode.
-   * @param string $format
-   *   Format name.
-   *
-   * @return string
-   *   A string representation of $data in the requested format.
+   * Implements \Symfony\Component\Serializer\Encoder\EncoderInterface::encode().
    */
-  public function encode($data, $format) {
+  public function encode($data, $format, array $context=array()) {
     // @see Drupal\serialization_test\SerializationTestNormalizer::normalize().
     return 'Normalized by ' . $data['normalized_by'] . ', Encoded by SerializationTestEncoder';
   }
 
   /**
-   * Checks whether this encoder can encode to the requested format.
-   *
-   * @param string $format
-   *   The short name of the format.
-   *
-   * @return bool
-   *   Returns TRUE if this encoder can encode to the requested format.
+   * Implements \Symfony\Component\Serializer\Encoder\EncoderInterface::supportsEncoding().
    */
   public function supportsEncoding($format) {
     return static::$format === $format;
diff --git a/core/modules/system/tests/modules/serialization_test/lib/Drupal/serialization_test/SerializationTestNormalizer.php b/core/modules/system/tests/modules/serialization_test/lib/Drupal/serialization_test/SerializationTestNormalizer.php
index 5519fe9..81478c5 100644
--- a/core/modules/system/tests/modules/serialization_test/lib/Drupal/serialization_test/SerializationTestNormalizer.php
+++ b/core/modules/system/tests/modules/serialization_test/lib/Drupal/serialization_test/SerializationTestNormalizer.php
@@ -30,7 +30,7 @@ class SerializationTestNormalizer implements NormalizerInterface {
    *   An array containing a normalized representation of $object, appropriate
    *   for encoding to the requested format.
    */
-  public function normalize($object, $format = NULL) {
+  public function normalize($object, $format = NULL, array $context = array()) {
     $normalized = (array) $object;
     // Add identifying value that can be used to verify that the expected
     // normalizer was invoked.
diff --git a/core/vendor/composer/installed.json b/core/vendor/composer/installed.json
index e8e495c..6fdac5a 100644
--- a/core/vendor/composer/installed.json
+++ b/core/vendor/composer/installed.json
@@ -576,55 +576,6 @@
         "homepage": "http://symfony.com"
     },
     {
-        "name": "symfony/serializer",
-        "version": "dev-master",
-        "version_normalized": "9999999-dev",
-        "target-dir": "Symfony/Component/Serializer",
-        "source": {
-            "type": "git",
-            "url": "https://github.com/symfony/Serializer",
-            "reference": "ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0"
-        },
-        "dist": {
-            "type": "zip",
-            "url": "https://github.com/symfony/Serializer/archive/ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0.zip",
-            "reference": "ef3d92815bdb07281ee8cbd73b3e3f9e41bdc1a0",
-            "shasum": ""
-        },
-        "require": {
-            "php": ">=5.3.3"
-        },
-        "time": "2012-12-19 07:09:49",
-        "type": "library",
-        "extra": {
-            "branch-alias": {
-                "dev-master": "2.2-dev"
-            }
-        },
-        "installation-source": "source",
-        "autoload": {
-            "psr-0": {
-                "Symfony\\Component\\Serializer\\": ""
-            }
-        },
-        "notification-url": "https://packagist.org/downloads/",
-        "license": [
-            "MIT"
-        ],
-        "authors": [
-            {
-                "name": "Fabien Potencier",
-                "email": "fabien@symfony.com"
-            },
-            {
-                "name": "Symfony Community",
-                "homepage": "http://symfony.com/contributors"
-            }
-        ],
-        "description": "Symfony Serializer Component",
-        "homepage": "http://symfony.com"
-    },
-    {
         "name": "symfony/yaml",
         "version": "dev-master",
         "version_normalized": "9999999-dev",
@@ -931,6 +882,55 @@
         ]
     },
     {
+        "name": "symfony/serializer",
+        "version": "dev-master",
+        "version_normalized": "9999999-dev",
+        "target-dir": "Symfony/Component/Serializer",
+        "source": {
+            "type": "git",
+            "url": "https://github.com/symfony/Serializer",
+            "reference": "45fe843e3144a594f93a6a372385c6534c7df31c"
+        },
+        "dist": {
+            "type": "zip",
+            "url": "https://github.com/symfony/Serializer/archive/45fe843e3144a594f93a6a372385c6534c7df31c.zip",
+            "reference": "45fe843e3144a594f93a6a372385c6534c7df31c",
+            "shasum": ""
+        },
+        "require": {
+            "php": ">=5.3.3"
+        },
+        "time": "2013-01-19 07:50:02",
+        "type": "library",
+        "extra": {
+            "branch-alias": {
+                "dev-master": "2.2-dev"
+            }
+        },
+        "installation-source": "source",
+        "autoload": {
+            "psr-0": {
+                "Symfony\\Component\\Serializer\\": ""
+            }
+        },
+        "notification-url": "https://packagist.org/downloads/",
+        "license": [
+            "MIT"
+        ],
+        "authors": [
+            {
+                "name": "Fabien Potencier",
+                "email": "fabien@symfony.com"
+            },
+            {
+                "name": "Symfony Community",
+                "homepage": "http://symfony.com/contributors"
+            }
+        ],
+        "description": "Symfony Serializer Component",
+        "homepage": "http://symfony.com"
+    },
+    {
         "name": "symfony-cmf/routing",
         "version": "dev-master",
         "version_normalized": "9999999-dev",
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/.gitattributes b/core/vendor/symfony/serializer/Symfony/Component/Serializer/.gitattributes
deleted file mode 100644
index 8048151..0000000
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/.gitattributes
+++ /dev/null
@@ -1,2 +0,0 @@
-/Tests export-ignore
-phpunit.xml.dist export-ignore
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/CHANGELOG.md b/core/vendor/symfony/serializer/Symfony/Component/Serializer/CHANGELOG.md
index de46533..6ccf5e5 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/CHANGELOG.md
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/CHANGELOG.md
@@ -1,6 +1,16 @@
 CHANGELOG
 =========
 
+2.2.0
+-----
+
+ * [BC BREAK] All Serializer, Normalizer and Encoder interfaces have been
+   modified to include an optional `$context` array parameter.
+ * The XML Root name can now be configured with the `xml_root_name`
+   parameter in the context option to the `XmlEncoder`.
+ * Options to `json_encode` and `json_decode` can be passed through
+   the context options of `JsonEncode` and `JsonDecode` encoder/decoders.
+
 2.1.0
 -----
 
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/ChainDecoder.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/ChainDecoder.php
index f555c6a..6ece3b2 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/ChainDecoder.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/ChainDecoder.php
@@ -34,9 +34,9 @@ public function __construct(array $decoders = array())
     /**
      * {@inheritdoc}
      */
-    final public function decode($data, $format)
+    final public function decode($data, $format, array $context = array())
     {
-        return $this->getDecoder($format)->decode($data, $format);
+        return $this->getDecoder($format)->decode($data, $format, $context);
     }
 
     /**
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/ChainEncoder.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/ChainEncoder.php
index ebb81ef..bd10a2a 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/ChainEncoder.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/ChainEncoder.php
@@ -35,9 +35,9 @@ public function __construct(array $encoders = array())
     /**
      * {@inheritdoc}
      */
-    final public function encode($data, $format)
+    final public function encode($data, $format, array $context = array())
     {
-        return $this->getEncoder($format)->encode($data, $format);
+        return $this->getEncoder($format)->encode($data, $format, $context);
     }
 
     /**
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/DecoderInterface.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/DecoderInterface.php
index e95271f..ffd221f 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/DecoderInterface.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/DecoderInterface.php
@@ -23,10 +23,11 @@
      *
      * @param scalar $data   Data to decode
      * @param string $format Format name
+     * @param array  $context options that decoders have access to.
      *
      * @return mixed
      */
-    public function decode($data, $format);
+    public function decode($data, $format, array $context = array());
 
     /**
      * Checks whether the serializer can decode from given format
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/EncoderInterface.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/EncoderInterface.php
index 4a68ad3..2290db7 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/EncoderInterface.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/EncoderInterface.php
@@ -23,10 +23,11 @@
      *
      * @param mixed  $data   Data to encode
      * @param string $format Format name
+     * @param array  $context options that normalizers/encoders have access to.
      *
      * @return scalar
      */
-    public function encode($data, $format);
+    public function encode($data, $format, array $context = array());
 
     /**
      * Checks whether the serializer can encode to given format
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonDecode.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonDecode.php
index 7ed8039..e7cd9e0 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonDecode.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonDecode.php
@@ -21,6 +21,7 @@ class JsonDecode implements DecoderInterface
     private $associative;
     private $recursionDepth;
     private $lastError = JSON_ERROR_NONE;
+    protected $serializer;
 
     public function __construct($associative = false, $depth = 512)
     {
@@ -48,9 +49,20 @@ public function getLastError()
      *
      * @return mixed
      */
-    public function decode($data, $format)
+    public function decode($data, $format, array $context = array())
     {
-        $decodedData = json_decode($data, $this->associative, $this->recursionDepth);
+        $context = $this->resolveContext($context);
+
+        $associative    = $context['json_decode_associative'];
+        $recursionDepth = $context['json_decode_recursion_depth'];
+        $options        = $context['json_decode_options'];
+
+        if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
+            $decodedData = json_decode($data, $associative, $recursionDepth, $options);
+        } else {
+            $decodedData = json_decode($data, $associative, $recursionDepth);
+        }
+
         $this->lastError = json_last_error();
 
         return $decodedData;
@@ -63,4 +75,21 @@ public function supportsDecoding($format)
     {
         return JsonEncoder::FORMAT === $format;
     }
+
+    /**
+     * Merge the default options of the Json Decoder with the passed context.
+     *
+     * @param array $context
+     * @return array
+     */
+    private function resolveContext(array $context)
+    {
+        $defaultOptions = array(
+            'json_decode_associative' => $this->associative,
+            'json_decode_recursion_depth' => $this->recursionDepth,
+            'json_decode_options' => 0
+        );
+
+        return array_merge($defaultOptions, $context);
+    }
 }
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonEncode.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonEncode.php
index 280b8a9..4e0de3e 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonEncode.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonEncode.php
@@ -41,14 +41,13 @@ public function getLastError()
     /**
      * Encodes PHP data to a JSON string
      *
-     * @param mixed  $data
-     * @param string $format
-     *
-     * @return string
+     * {@inheritdoc}
      */
-    public function encode($data, $format)
+    public function encode($data, $format, array $context = array())
     {
-        $encodedJson = json_encode($data, $this->options);
+        $context = $this->resolveContext($context);
+
+        $encodedJson = json_encode($data, $context['json_encode_options']);
         $this->lastError = json_last_error();
 
         return $encodedJson;
@@ -61,4 +60,15 @@ public function supportsEncoding($format)
     {
         return JsonEncoder::FORMAT === $format;
     }
+
+    /**
+     * Merge default json encode options with context.
+     *
+     * @param array $context
+     * @return array
+     */
+    private function resolveContext(array $context = array())
+    {
+        return array_merge(array('json_encode_options' => $this->options), $context);
+    }
 }
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonEncoder.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonEncoder.php
index 73918b7..02b179b 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonEncoder.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/JsonEncoder.php
@@ -59,17 +59,17 @@ public function getLastDecodingError()
     /**
      * {@inheritdoc}
      */
-    public function encode($data, $format)
+    public function encode($data, $format, array $context = array())
     {
-        return $this->encodingImpl->encode($data, self::FORMAT);
+        return $this->encodingImpl->encode($data, self::FORMAT, $context);
     }
 
     /**
      * {@inheritdoc}
      */
-    public function decode($data, $format)
+    public function decode($data, $format, array $context = array())
     {
-        return $this->decodingImpl->decode($data, self::FORMAT);
+        return $this->decodingImpl->decode($data, self::FORMAT, $context);
     }
 
     /**
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/XmlEncoder.php
index 11de50a..909b3ce 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/XmlEncoder.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Encoder/XmlEncoder.php
@@ -27,23 +27,35 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
     private $rootNodeName = 'response';
 
     /**
+     * Construct new XmlEncoder and allow to change the root node element name.
+     *
+     * @param string $rootNodeName
+     */
+    public function __construct($rootNodeName = 'response')
+    {
+        $this->rootNodeName = $rootNodeName;
+    }
+
+    /**
      * {@inheritdoc}
      */
-    public function encode($data, $format)
+    public function encode($data, $format, array $context = array())
     {
         if ($data instanceof \DOMDocument) {
             return $data->saveXML();
         }
 
+        $xmlRootNodeName = $this->resolveXmlRootName($context);
+
         $this->dom = new \DOMDocument();
         $this->format = $format;
 
         if (null !== $data && !is_scalar($data)) {
-            $root = $this->dom->createElement($this->rootNodeName);
+            $root = $this->dom->createElement($xmlRootNodeName);
             $this->dom->appendChild($root);
-            $this->buildXml($root, $data);
+            $this->buildXml($root, $data, $xmlRootNodeName);
         } else {
-            $this->appendNode($this->dom, $data, $this->rootNodeName);
+            $this->appendNode($this->dom, $data, $xmlRootNodeName);
         }
 
         return $this->dom->saveXML();
@@ -52,7 +64,7 @@ public function encode($data, $format)
     /**
      * {@inheritdoc}
      */
-    public function decode($data, $format)
+    public function decode($data, $format, array $context = array())
     {
         $internalErrors = libxml_use_internal_errors(true);
         $disableEntities = libxml_disable_entity_loader(true);
@@ -269,12 +281,13 @@ private function parseXml($node)
      *
      * @param DOMNode      $parentNode
      * @param array|object $data       data
+     * @param string       $xmlRootNodeName
      *
      * @return Boolean
      *
      * @throws UnexpectedValueException
      */
-    private function buildXml($parentNode, $data)
+    private function buildXml($parentNode, $data, $xmlRootNodeName)
     {
         $append = true;
 
@@ -310,21 +323,24 @@ private function buildXml($parentNode, $data)
 
             return $append;
         }
+
         if (is_object($data)) {
             $data = $this->serializer->normalize($data, $this->format);
             if (null !== $data && !is_scalar($data)) {
-                return $this->buildXml($parentNode, $data);
+                return $this->buildXml($parentNode, $data, $xmlRootNodeName);
             }
+
             // top level data object was normalized into a scalar
             if (!$parentNode->parentNode->parentNode) {
                 $root = $parentNode->parentNode;
                 $root->removeChild($parentNode);
 
-                return $this->appendNode($root, $data, $this->rootNodeName);
+                return $this->appendNode($root, $data, $xmlRootNodeName);
             }
 
             return $this->appendNode($parentNode, $data, 'data');
         }
+
         throw new UnexpectedValueException('An unexpected value could not be serialized: '.var_export($data, true));
     }
 
@@ -376,7 +392,7 @@ private function needsCdataWrapping($val)
     private function selectNodeType($node, $val)
     {
         if (is_array($val)) {
-            return $this->buildXml($node, $val);
+            return $this->buildXml($node, $val, null);
         } elseif ($val instanceof \SimpleXMLElement) {
             $child = $this->dom->importNode(dom_import_simplexml($val), true);
             $node->appendChild($child);
@@ -399,4 +415,15 @@ private function selectNodeType($node, $val)
 
         return true;
     }
+
+    /**
+     * Get real XML root node name, taking serializer options into account.
+     */
+    private function resolveXmlRootName(array $context = array())
+    {
+        return isset($context['xml_root_node_name'])
+            ? $context['xml_root_node_name']
+            : $this->rootNodeName;
+    }
+
 }
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/LICENSE b/core/vendor/symfony/serializer/Symfony/Component/Serializer/LICENSE
index cdffe7a..88a57f8 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/LICENSE
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2012 Fabien Potencier
+Copyright (c) 2004-2013 Fabien Potencier
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php
index 4510fa0..0ebe00f 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php
@@ -19,18 +19,18 @@ class CustomNormalizer extends SerializerAwareNormalizer implements NormalizerIn
     /**
      * {@inheritdoc}
      */
-    public function normalize($object, $format = null)
+    public function normalize($object, $format = null, array $context = array())
     {
-        return $object->normalize($this->serializer, $format);
+        return $object->normalize($this->serializer, $format, $context);
     }
 
     /**
      * {@inheritdoc}
      */
-    public function denormalize($data, $class, $format = null)
+    public function denormalize($data, $class, $format = null, array $context = array())
     {
         $object = new $class;
-        $object->denormalize($this->serializer, $data, $format);
+        $object->denormalize($this->serializer, $data, $format, $context);
 
         return $object;
     }
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php
index 3f3bf88..5a1b4c1 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php
@@ -32,6 +32,7 @@
      * @param array|scalar $data   The data from which to re-create the object.
      * @param string|null  $format The format is optionally given to be able to denormalize differently
      *   based on different input formats.
+     * @param array        $context options for denormalizing
      */
-    public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null);
+    public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array());
 }
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php
index 384f9fe..1a5ff93 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php
@@ -24,10 +24,11 @@
      * @param mixed  $data   data to restore
      * @param string $class  the expected class to instantiate
      * @param string $format format the given data was extracted from
+     * @param array  $context options available to the denormalizer
      *
      * @return object
      */
-    public function denormalize($data, $class, $format = null);
+    public function denormalize($data, $class, $format = null, array $context = array());
 
     /**
      * Checks whether the given class is supported for denormalization by this normalizer
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
index 2c5f1b3..63e7a1d 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
@@ -69,7 +69,7 @@ public function setIgnoredAttributes(array $ignoredAttributes)
     /**
      * {@inheritdoc}
      */
-    public function normalize($object, $format = null)
+    public function normalize($object, $format = null, array $context = array())
     {
         $reflectionObject = new \ReflectionObject($object);
         $reflectionMethods = $reflectionObject->getMethods(\ReflectionMethod::IS_PUBLIC);
@@ -101,7 +101,7 @@ public function normalize($object, $format = null)
     /**
      * {@inheritdoc}
      */
-    public function denormalize($data, $class, $format = null)
+    public function denormalize($data, $class, $format = null, array $context = array())
     {
         $reflectionClass = new \ReflectionClass($class);
         $constructor = $reflectionClass->getConstructor();
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php
index fb77a83..07c3a4a 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php
@@ -31,8 +31,9 @@
      *   can use it to normalize objects contained within this object.
      * @param string|null $format The format is optionally given to be able to normalize differently
      *   based on different output formats.
+     * @param array $context Options for normalizing this object
      *
      * @return array|scalar
      */
-    public function normalize(NormalizerInterface $normalizer, $format = null);
+    public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array());
 }
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php
index f0915db..744307a 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php
@@ -23,10 +23,11 @@
      *
      * @param object $object object to normalize
      * @param string $format format the normalization result will be encoded as
+     * @param array $context Context options for the normalizer
      *
      * @return array|scalar
      */
-    public function normalize($object, $format = null);
+    public function normalize($object, $format = null, array $context = array());
 
     /**
      * Checks whether the given class is supported for normalization by this normalizer
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Serializer.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Serializer.php
index cad6963..ab6fd58 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Serializer.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Serializer.php
@@ -39,8 +39,8 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
 {
     protected $encoder;
     protected $decoder;
-    protected $normalizers = array();
-    protected $normalizerCache = array();
+    protected $normalizers       = array();
+    protected $normalizerCache   = array();
     protected $denormalizerCache = array();
 
     public function __construct(array $normalizers = array(), array $encoders = array())
@@ -72,58 +72,58 @@ public function __construct(array $normalizers = array(), array $encoders = arra
     /**
      * {@inheritdoc}
      */
-    final public function serialize($data, $format)
+    final public function serialize($data, $format, array $context = array())
     {
         if (!$this->supportsEncoding($format)) {
             throw new UnexpectedValueException('Serialization for the format '.$format.' is not supported');
         }
 
         if ($this->encoder->needsNormalization($format)) {
-            $data = $this->normalize($data, $format);
+            $data = $this->normalize($data, $format, $context);
         }
 
-        return $this->encode($data, $format);
+        return $this->encode($data, $format, $context);
     }
 
     /**
      * {@inheritdoc}
      */
-    final public function deserialize($data, $type, $format)
+    final public function deserialize($data, $type, $format, array $context = array())
     {
         if (!$this->supportsDecoding($format)) {
             throw new UnexpectedValueException('Deserialization for the format '.$format.' is not supported');
         }
 
-        $data = $this->decode($data, $format);
+        $data = $this->decode($data, $format, $context);
 
-        return $this->denormalize($data, $type, $format);
+        return $this->denormalize($data, $type, $format, $context);
     }
 
     /**
      * {@inheritdoc}
      */
-    public function normalize($data, $format = null)
+    public function normalize($data, $format = null, array $context = array())
     {
         if (null === $data || is_scalar($data)) {
             return $data;
         }
         if (is_object($data) && $this->supportsNormalization($data, $format)) {
-            return $this->normalizeObject($data, $format);
+            return $this->normalizeObject($data, $format, $context);
         }
         if ($data instanceof \Traversable) {
             $normalized = array();
             foreach ($data as $key => $val) {
-                $normalized[$key] = $this->normalize($val, $format);
+                $normalized[$key] = $this->normalize($val, $format, $context);
             }
 
             return $normalized;
         }
         if (is_object($data)) {
-            return $this->normalizeObject($data, $format);
+            return $this->normalizeObject($data, $format, $context);
         }
         if (is_array($data)) {
             foreach ($data as $key => $val) {
-                $data[$key] = $this->normalize($val, $format);
+                $data[$key] = $this->normalize($val, $format, $context);
             }
 
             return $data;
@@ -134,9 +134,9 @@ public function normalize($data, $format = null)
     /**
      * {@inheritdoc}
      */
-    public function denormalize($data, $type, $format = null)
+    public function denormalize($data, $type, $format = null, array $context = array())
     {
-        return $this->denormalizeObject($data, $type, $format);
+        return $this->denormalizeObject($data, $type, $format, $context);
     }
 
     /**
@@ -202,17 +202,17 @@ private function getDenormalizer($data, $type, $format = null)
     /**
      * {@inheritdoc}
      */
-    final public function encode($data, $format)
+    final public function encode($data, $format, array $context = array())
     {
-        return $this->encoder->encode($data, $format);
+        return $this->encoder->encode($data, $format, $context);
     }
 
     /**
      * {@inheritdoc}
      */
-    final public function decode($data, $format)
+    final public function decode($data, $format, array $context = array())
     {
-        return $this->decoder->decode($data, $format);
+        return $this->decoder->decode($data, $format, $context);
     }
 
     /**
@@ -220,13 +220,14 @@ private function getDenormalizer($data, $type, $format = null)
      *
      * @param object $object object to normalize
      * @param string $format format name, present to give the option to normalizers to act differently based on formats
+     * @param array $context The context data for this particular normalization
      *
      * @return array|scalar
      *
      * @throws LogicException
      * @throws UnexpectedValueException
      */
-    private function normalizeObject($object, $format = null)
+    private function normalizeObject($object, $format = null, array $context = array())
     {
         if (!$this->normalizers) {
             throw new LogicException('You must register at least one normalizer to be able to normalize objects.');
@@ -234,14 +235,14 @@ private function normalizeObject($object, $format = null)
 
         $class = get_class($object);
         if (isset($this->normalizerCache[$class][$format])) {
-            return $this->normalizerCache[$class][$format]->normalize($object, $format);
+            return $this->normalizerCache[$class][$format]->normalize($object, $format, $context);
         }
 
         foreach ($this->normalizers as $normalizer) {
             if ($normalizer->supportsNormalization($object, $format)) {
                 $this->normalizerCache[$class][$format] = $normalizer;
 
-                return $normalizer->normalize($object, $format);
+                return $normalizer->normalize($object, $format, $context);
             }
         }
 
@@ -254,27 +255,28 @@ private function normalizeObject($object, $format = null)
      * @param mixed  $data   data to restore
      * @param string $class  the expected class to instantiate
      * @param string $format format name, present to give the option to normalizers to act differently based on formats
+     * @param array $context The context data for this particular denormalization
      *
      * @return object
      *
      * @throws LogicException
      * @throws UnexpectedValueException
      */
-    private function denormalizeObject($data, $class, $format = null)
+    private function denormalizeObject($data, $class, $format = null, array $context = array())
     {
         if (!$this->normalizers) {
             throw new LogicException('You must register at least one normalizer to be able to denormalize objects.');
         }
 
         if (isset($this->denormalizerCache[$class][$format])) {
-            return $this->denormalizerCache[$class][$format]->denormalize($data, $class, $format);
+            return $this->denormalizerCache[$class][$format]->denormalize($data, $class, $format, $context);
         }
 
         foreach ($this->normalizers as $normalizer) {
             if ($normalizer->supportsDenormalization($data, $class, $format)) {
                 $this->denormalizerCache[$class][$format] = $normalizer;
 
-                return $normalizer->denormalize($data, $class, $format);
+                return $normalizer->denormalize($data, $class, $format, $context);
             }
         }
 
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/SerializerInterface.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/SerializerInterface.php
index 143179f..d196d78 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/SerializerInterface.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/SerializerInterface.php
@@ -21,12 +21,13 @@
     /**
      * Serializes data in the appropriate format
      *
-     * @param mixed  $data   any data
-     * @param string $format format name
+     * @param mixed  $data    any data
+     * @param string $format  format name
+     * @param array  $context options normalizers/encoders have access to
      *
      * @return string
      */
-    public function serialize($data, $format);
+    public function serialize($data, $format, array $context = array());
 
     /**
      * Deserializes data into the given type.
@@ -34,8 +35,9 @@ public function serialize($data, $format);
      * @param mixed  $data
      * @param string $type
      * @param string $format
+     * @param array  $context
      *
      * @return object
      */
-    public function deserialize($data, $type, $format);
+    public function deserialize($data, $type, $format, array $context = array());
 }
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php
new file mode 100644
index 0000000..c2f6072
--- /dev/null
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php
@@ -0,0 +1,80 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Serializer\Tests\Encoder;
+
+use Symfony\Component\Serializer\Encoder\JsonEncoder;
+use Symfony\Component\Serializer\Serializer;
+use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
+
+class JsonEncoderTest extends \PHPUnit_Framework_TestCase
+{
+    protected function setUp()
+    {
+        $this->encoder = new JsonEncoder;
+        $this->serializer = new Serializer(array(new CustomNormalizer()), array('json' => new JsonEncoder()));
+    }
+
+    public function testEncodeScalar()
+    {
+        $obj = new \stdClass;
+        $obj->foo = "foo";
+
+        $expected = '{"foo":"foo"}';
+
+        $this->assertEquals($expected, $this->encoder->encode($obj, 'json'));
+    }
+
+    public function testComplexObject()
+    {
+        $obj = $this->getObject();
+
+        $expected = $this->getJsonSource();
+
+        $this->assertEquals($expected, $this->encoder->encode($obj, 'json'));
+    }
+
+    public function testOptions()
+    {
+        $context = array('json_encode_options' => JSON_NUMERIC_CHECK);
+
+        $arr = array();
+        $arr['foo'] = "3";
+
+        $expected = '{"foo":3}';
+
+        $this->assertEquals($expected, $this->serializer->serialize($arr, 'json', $context));
+
+        $arr = array();
+        $arr['foo'] = "3";
+
+        $expected = '{"foo":"3"}';
+
+        $this->assertEquals($expected, $this->serializer->serialize($arr, 'json'), 'Context should not be persistent');
+    }
+
+
+    protected function getJsonSource()
+    {
+        return '{"foo":"foo","bar":["a","b"],"baz":{"key":"val","key2":"val","A B":"bar","item":[{"title":"title1"},{"title":"title2"}],"Barry":{"FooBar":{"Baz":"Ed","@id":1}}},"qux":"1"}';
+    }
+
+    protected function getObject()
+    {
+        $obj = new \stdClass;
+        $obj->foo = 'foo';
+        $obj->bar = array('a', 'b');
+        $obj->baz = array('key' => 'val', 'key2' => 'val', 'A B' => 'bar', 'item' => array(array('title' => 'title1'), array('title' => 'title2')), 'Barry' => array('FooBar' => array('Baz' => 'Ed', '@id' => 1)));
+        $obj->qux = "1";
+
+        return $obj;
+    }
+}
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
index 23cb021..b23d4c7 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
@@ -184,6 +184,23 @@ public function testEncode()
         $this->assertEquals($source, $this->encoder->encode($obj, 'xml'));
     }
 
+    public function testEncodeSerializerXmlRootNodeNameOption()
+    {
+        $options = array('xml_root_node_name' => 'test');
+        $this->encoder = new XmlEncoder;
+        $serializer = new Serializer(array(), array('xml' => new XmlEncoder()));
+        $this->encoder->setSerializer($serializer);
+
+        $array = array(
+            'person' => array('@gender' => 'M', '#' => 'Peter'),
+        );
+
+        $expected = '<?xml version="1.0"?>'."\n".
+            '<test><person gender="M">Peter</person></test>'."\n";
+
+        $this->assertEquals($expected, $serializer->serialize($array, 'xml', $options));
+    }
+
     public function testDecode()
     {
         $source = $this->getXmlSource();
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/DenormalizableDummy.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/DenormalizableDummy.php
index 468d444..09b8a52 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/DenormalizableDummy.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/DenormalizableDummy.php
@@ -17,7 +17,7 @@
 class DenormalizableDummy implements DenormalizableInterface
 {
 
-    public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null)
+    public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array())
     {
 
     }
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/Dummy.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/Dummy.php
index cdcf510..6b33e84 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/Dummy.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/Dummy.php
@@ -23,7 +23,7 @@ class Dummy implements NormalizableInterface, DenormalizableInterface
     public $baz;
     public $qux;
 
-    public function normalize(NormalizerInterface $normalizer, $format = null)
+    public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array())
     {
         return array(
             'foo' => $this->foo,
@@ -33,7 +33,7 @@ public function normalize(NormalizerInterface $normalizer, $format = null)
         );
     }
 
-    public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null)
+    public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array())
     {
         $this->foo = $data['foo'];
         $this->bar = $data['bar'];
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/NormalizableTraversableDummy.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/NormalizableTraversableDummy.php
index ba1f924..3ac2fe3 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/NormalizableTraversableDummy.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/NormalizableTraversableDummy.php
@@ -18,7 +18,7 @@
 
 class NormalizableTraversableDummy extends TraversableDummy implements NormalizableInterface, DenormalizableInterface
 {
-    public function normalize(NormalizerInterface $normalizer, $format = null)
+    public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array())
     {
         return array(
             'foo' => 'normalizedFoo',
@@ -26,7 +26,7 @@ public function normalize(NormalizerInterface $normalizer, $format = null)
         );
     }
 
-    public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null)
+    public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array())
     {
         return array(
             'foo' => 'denormalizedFoo',
diff --git a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/ScalarDummy.php b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/ScalarDummy.php
index 1b0516a..e9db238 100644
--- a/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/ScalarDummy.php
+++ b/core/vendor/symfony/serializer/Symfony/Component/Serializer/Tests/Fixtures/ScalarDummy.php
@@ -21,12 +21,12 @@ class ScalarDummy implements NormalizableInterface, DenormalizableInterface
     public $foo;
     public $xmlFoo;
 
-    public function normalize(NormalizerInterface $normalizer, $format = null)
+    public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array())
     {
         return $format === 'xml' ? $this->xmlFoo : $this->foo;
     }
 
-    public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null)
+    public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array())
     {
         if ($format === 'xml') {
             $this->xmlFoo = $data;
