I have the same question as this .And the second answer there solved my problem.The solution is
sensio_framework_extra:
view: { annotations: false }
router: { annotations: true }
fos_rest:
param_fetcher_listener: true
body_listener: true
format_listener: true
view:
view_response_listener: 'force'
formats:
xml: true
json : true
templating_formats:
html: true
force_redirects:
html: true
failed_validation: HTTP_BAD_REQUEST
default_engine: twig
routing_loader:
default_format: json
But i dint understand how this solved the problem and why dint this configuration solved my problem.
fos_rest:
routing_loader:
default_format: json
view:
view_response_listener: true
Can anyone explain me the configuration.