Symfony Serializer of DateTime Response String

前端 未结 3 677
醉话见心
醉话见心 2020-12-19 17:53

When attempting to perform a doctrine query and serialze it to json (not using JSM, using the symfony serializer) I get the following in the json:

\"\"due\":{\"timez

3条回答
  •  太阳男子
    2020-12-19 18:36

    Another option is to pass arguments to the default DateTimeNormalizer in services.yaml:

      Symfony\Component\Serializer\Normalizer\DateTimeNormalizer:
        arguments:
          $defaultContext:
            datetime_format: 'Y-m-d\TH:i:s.v\Z'
    

提交回复
热议问题