Consuming RESTful web services
OH, just realized now, maybe I misunderstood the question 100%

This is the code which basically generates the output:

$serializer = \Drupal::service('serializer'):
$output = $serializer-&gt;serialize($entity, $format);


with $format for example being 'json'.

Luckily the serializer is symetric, so you can do the same the other way round.

$client = \Drupal::service('http_client');
$result = $client-&gt;get('http://example.com/entity/node/1', ['Accept' =&gt; 'application/json']);
$output = $result-&gt;getBody();

$serializer = \Drupal::service('serializer'):
$entity = $serializer-&gt;deserialize($output, 'Drupal\node\Entity\Node', $format);