code: public function entityFromBody($body, $entity)
      {
          $json = $this->decodeJson($body);
          return $entity->populate($json);
      }
docs: Populate an entity from request or response body
  
  @param string $body
  @param Entity $entity
  @return Entity