Skip to Content
Author's profile photo Atul Jaiswal

Defaulting OData response in json format

Hello All,

In my ongoing learning I came across enough learning blogs on how to create OData services , debug it  consume it etc. However at some point I was stuck in the end about how do I default my web service response to json format?

It might be very common concept for most of other learners but still could be handy for any new learner who need it as quick reference.

We have multiple ways to test/execute our OData web services. Most common platforms are through the click on ‘SAP Gateway client’ button or the Postman.

Note: Creation of Odata service are not included as we have various good material for the same.


Execution via:

Gateway client: T-code SEGW


Click on SAP Gateway Client button. It will navigate to the hub system.

At the left top side above HTTP request click on Add header button and add the below two header parameters as mentioned below with value as application/json

Content-Type for input in case we have post methods


Accept-> For the default response format


Click on execute button

Sample Get Method


Sample Post response


Execution via Postman service

Below header parameters would be need for the json format response.


Hope this helps and saves time for fellow learners.



Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Ankit Maskara
      Ankit Maskara

      You can very well use the system query option $format=json to enable retrieval data in JSON format.

      Author's profile photo Saket Kumar
      Saket Kumar

      But this will only work for Get method, for post we cannot use as it will give query error.
      For Post method, have to pass accept: application/json in header request.

      Author's profile photo Ankit Maskara
      Ankit Maskara

      Yes, agreed that's why I mentioned it can be used for data retrieval.

      Author's profile photo vemu rusum
      vemu rusum

      I passed header as accept  application/json also still i am getting error

      Author's profile photo Yoppy Santoso
      Yoppy Santoso

      Nice blog,
      but, how to post with like this json :


      "Ebeln" : "Value ebeln",
      "Ebelp" : "Value ebelp"



      "Ebeln" : "Value ebeln",
      "Ebelp" : "Value ebelp"


      Author's profile photo Arun Kumar
      Arun Kumar

      Check this blog:

      Author's profile photo David Da Silva
      David Da Silva

      I found this very useful today! Many thanks