As explained in How to render plain JSON (without any additional tag) data in DXA 1.5 java?, it is possible to retrieve the contents of a page as JSON by adding ?format=json to the URL. I've tried that in DXA 2, and it still works fine.

However, it is also claimed that you can achieve the same result by sending an Accept header with value 'application/json'. This does not work for me. Do I need to send another header as well? Or was this feature removed in DXA 2?

1 Answer 1


Indeed, it should be possible to get JSON format by specifying an HTTP Accept header with value application/json

See method DataFormatters.GetFormat in https://github.com/sdl/dxa-web-application-dotnet/blob/master/Sdl.Web.Mvc/Formats/DataFormatters.cs

Admittedly, the logic to select a data formatter based on Accept header is quite convoluted (it can use some refactoring!) and might be defective as a result.

  • Convoluted is an understatement if you ask me.. Anyway, as a monkey tester I can tell you it doesn't work :)
    – Quirijn
    Sep 25, 2018 at 11:49
  • I miss the simple logic of: if acceptHeader == application/json then return application/json indeed. Might be good to log a ticket for this?
    – Raimond
    Nov 21, 2018 at 19:42
  • Yes, by all means, report an Issue in GitHub. Nov 21, 2018 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.