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
Diwakar G 7Diwakar G 7 

Passing Json to call post method

Please help me in creating body using Apex. I need to pass the body in post method.
    { "n": "MyApexClass", "r": false,  "t": "ApexClass" },
    { "n": "SysAdmin", "r": false, "t": "Profile" },
    { "n": "Account", "r": true, "t": "CustomObject" }

Thanks and Regards,
Diwakar G
Raj VakatiRaj Vakati
Refer this code
// Sening the http body with JSON 
String jsonData ='[{ "n": "MyApexClass", "r": false,  "t": "ApexClass" },{ "n": "SysAdmin", "r": false, "t": "Profile" },{ "n": "Account", "r": true, "t": "CustomObject" }]' ; 
String endpoint = '';
HttpRequest req = new HttpRequest();
Http http = new Http();
HTTPResponse response = http.send(req);