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
WhiteFusion17WhiteFusion17 

Http Body of apex outbound call line breaks issue

Hello I'm doing a rest post request to Trello to create a card however the http.sendbody is giving me issues basically I have to send  a string value but need to ensure it can support line breaks and is in JSON.

is there a method I can use to present the format in JSON ? The format should be ["desc", "VAlue from custom object"]


Value from the custom object should use \n for line breaks

any help would be amazing 
 

Best Answer chosen by WhiteFusion17
WhiteFusion17WhiteFusion17
Manged to fix this i used the following:

string body = '{"desc":'
                            + Json.serialize(ticket.Trello_Card_Description__c)
                            +'}';
The json.serialize formats the line breaks correctly.