You have to define this config in config/packages/api_platform.yml:
api_platform: serializer: hydra_prefix: true