You can directly call: $this->serializer->normalize($object->getData(), $format, $context);

Seems useless to call a method which return the same thing