How to convert objects into array using serialization API?
I tried serializer.normalizer.content_entity but got no success in normalizing the (node) revision entity, or even node entity for that matter. It always resulted in the following error:


  PHP Fatal error:  Call to a member function normalize() on a non-object in core/modules/serialization/src/Normalizer/ContentEntityNormalizer.php on line 28


For this I had to enable the serialization module. I also tried with the ContentEntityNormalizer provided by the "hal" module from core. Result same error:


  PHP Fatal error:  Call to a member function normalize() on a non-object in core/modules/hal/src/Normalizer/ContentEntityNormalizer.php on line 95


I had success with directly using the serializer service from the serialization module. The working code for serializing a node revision is given below. It was verified on /devel/php

$revision = node_revision_load(4);
$container = \Drupal::getContainer();
$normalizer = $container-&gt;get('serializer');
$normalized_array = $serializer-&gt;normalize($revision);
dsm($normalized_array);


Or combine line 2 and 3 above to get the serializer directly as 

$serializer = \Drupal::service('serializer');


In your setup() function, you need the following change:

$this-&gt;serializer = $this-&gt;container-&gt;get('serializer');


P.S: I am still trying to figure out why serializer.normalizer.content_entity is not working and throwing the errors.