How I can see what the JSON response looks like for a REST service that looks like the one below? I guess I'm looking for the actual steps of what I need to do to see the JSON response.

@RestResource(urlMapping = '/BP_Routes/*')
global with sharing class BP_Routes {

    @HttpPost //Method name
    //Check for User Authentication based on UserName and Password from external system
    global static ResponseWrapper BP_Routes(string username) {

        String strStatusMsg = '';//Holds the status message
        Integer isSuccessRes;//Holds the success response '1' or '0'
        list<Routewrapper> lstRteWrap = new list<Routewrapper>();
        list<personRoutesWrapper> lstPrsnWrap = new list<personRoutesWrapper>();

3 Answers 3


You can head over Salesforce Workbench and use the REST Utility to test the endpoint .

enter image description here

Your endpoint to test will be


Also looks like the method is accepting a string parameter ,so you will need to select post and then the JSON input is

  "username" : "test"

The response will tell you the JSON structure .Also just by looking into the ResponseWrapper class you will know the structure of the JSON .


IN exec anonymous simply type:


and it will debug what is returned. If you like you can serialize it since it is not serialized in your class:


And the other answers work as well, this is just pretty easy to do without leaving org


It will be based on the return type you are sending. For example your code is sending ResponseWrapper for HTTP-Post call with URL '/services/apexrest/BP_Routes'

Let's assume you have defined RepsonseWrapper structure as below -

global Class ResponseWrapper{
    public String statusCode;
    public Datetime responseOut;
    public Integer recordCount;
    public List<Map<String, String>> errorMessages;

    public ResponseWrapper(){}

The JSON response would be like as below -

    "errorMessages":[{"errorMessage":"Some Error Message","errorCode":"SOME_ERROR_CODE"}],

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .