How to specify default format for FOS\RestBundle to json?

后端 未结 3 852
故里飘歌
故里飘歌 2021-01-11 14:20

My corresponding configuration is

fos_rest:
    view:
        view_response_listener: force

sensio_framework_extra:
    view:
        annotations: false
         


        
3条回答
  •  花落未央
    2021-01-11 15:14

    The final answer is much easier and is irrelevant to FOS\RestBundle:

    api:
        resource: "@APIBundle/Controller/"
        type:     annotation
        defaults: {_format: json} # <<<<<<<
        prefix:   /api/
    

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题