How to generate a j...
 
Notifications
Clear all

[Solved] How to generate a json body string from an object?

2 Posts
1 Users
0 Likes
314 Views
Posts: 205
 CWL
Admin
Issue starter
(@cwl)
Member
Joined: 11 years ago

How to quickly generate json body data for any object to post to a REST resource.

Issue Tags
1 Reply
Posts: 205
 CWL
Admin
Issue starter
(@cwl)
Member
Joined: 11 years ago
List <Data__c> dList = [SELECT Id, Name FROM Data__c WHERE Name = 'John'];
String jsonStr = JSON.serialize(dList);
System.Debug('jsonStr: ' + jsonStr);
Reply
Share: