function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RajaganagavelRajaganagavel 

Help on Apex get method to Json in Workbench

Hi Folks,

I have a custom object called  Jobs with two fields namely Job_Name, Vacancies.

I want to create an apex rest class with get method and it should give the data in json format in workbench as below

{
"Master":"Jobs",
"Fields":["JobName,Vacancies"],
"Data": [["HR","10"],["Manager","20"]]
}

Please help me how to achieve using which json methods
Gangadhar T 15Gangadhar T 15
Hi  Raj,


              I hope that  below link is useful to you .
 
                          https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_code_sample_basic.htm  



                

Thank You,
www.nubeselite.com
Development | Training | Consulting

Please mark this as solution if your problem is solved.  
RajaganagavelRajaganagavel
Hi Gangadhar,

Thanks,
Deepali KulshresthaDeepali Kulshrestha
Hi Rajaganagavel,


Greetings to you!

I have gone through your query and I realized.


Please visit the link for solution:

1. https://developer.salesforce.com/forums/?id=9060G000000XhMLQA0

2. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_code_sample_basic.htm

3. https://webkul.com/blog/how-to-run-rest-api-through-workbench-salesforce/

     
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
 
RajaganagavelRajaganagavel
Hi Deepika, 

Thanks for your prompt response.

I tried creating as per requirement different object but im facing challenges. Could you please help me on this.
https://developer.salesforce.com/forums/ForumsMain?id=9062I000000XngZQAS