You need to sign in to do that
Don't have an account?
ForceRookie
Body is null and how to solve this error: System.JSONException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
Please help me. What's wrong with my Queueable Class?
public class FolderDisplayInfo implements Queueable, Database.AllowsCallouts { public List<Folder__c> fld; public FolderDisplayInfo(List<Folder__c> folderList) { fld = folderList; } public void execute(QueueableContext context) { System.debug('Folders: ' + fld); Http http = new Http(); HttpRequest httpReq = new HttpRequest(); httpReq.setMethod('GET'); httpReq.setHeader('Content-Type','application/json'); httpReq.setEndpoint('<my endpoint>'); HttpResponse res = http.send(httpReq); System.debug('Response: ' + res); if(res.getstatusCode() == 200 && res.getbody() != null){ response = (List<cls_Response>)JSON.deserialize(res.getBody(), List<cls_Response>.class); System.debug('Body: ' + res.getBody()); } //update folders here... } public class cls_Response { public String folderName {get;set;} public String recordID{get;set;} public String parentFolder{get;set;} public String bucketID{get;set;} } public List<cls_Response> response {get;set;} }
Help me to get this response:
"00BO00000ABCD60EFG" : { //Record Id "folders" : [ //Object { "name" : "foldertest", "sfid" : "00B0000ABC3ab", "parent" : "<FOLDER LOOKUP field>", "folderID" : "<BUCKET ID>", "RecordID" : "<Record ID>" } ], }
Can you please share RAW response before deserialising?
Thanks.
You mean that?
Thanks for replying, Rajesh!
look like (not 100% sure though) special characters in json may be causing this issue. have you validated your json?
Try this https://www.freeformatter.com/json-escape.html or jsonlidator
Thanks.
Here is the JSON I should get:
Here is your correct json:
and apex:
Let me know if still an issue.
URL: https://json2apex.herokuapp.com/
Thanks
Still OK, what I have shared is base code. I am sure it will work.
Regards,
Raj