Task/Serialization/NormalizerTask.php
public function execute(ProcessState $state)
    {
        $options = $this->getOptions($state);

        if (!$this->normalizer->supportsNormalization($state->getInput(), $options['format'])) {
            throw new \UnexpectedValueException('Given value is not normalizable for format ' . $options['format']);
        }

        $normalizedData = $this->normalizer->normalize(
            $state->getInput(),
            $options['format'],
            $options['context']
        );
        $state->setOutput($normalizedData);
    }
public function execute(ProcessState $state)
    {
        $options = $this->getOptions($state);

        if (!$this->normalizer->supportsNormalization($state->getInput(), $options['format'])) {
            throw new \UnexpectedValueException('Given value is not normalizable for format ' . $options['format']);
        }

        $normalizedData = $this->normalizer->normalize(
            $state->getInput(),
            $options['format'],
            $options['context']
        );
        $state->setOutput($normalizedData);
    }
@param ProcessState $state

@throws \Symfony\Component\Serializer\Exception\LogicException
@throws \Symfony\Component\Serializer\Exception\InvalidArgumentException
@throws \Symfony\Component\Serializer\Exception\CircularReferenceException
@throws \Symfony\Component\OptionsResolver\Exception\ExceptionInterface