Please help me to get this JSON string deserialize as map of list of string.
public static void postPermissionSetAutoDelegation(Map<string,Set<String>> delegationMap,String OrgName)
{
String jsonstr = (String)JSON.serialize(delegationMap);
//The JSonStr -> {"ITL8090":["Administrator:TRUE","Bank_Operations_Reviewer:TRUE"]}
//Code skipped Retriving accessToken and instance URL
String uri = ResponseMap.get('instance_url') + '/services/apexrest/PermSetDelegation/';
System.debug(uri);
//Post the data
HttpResponse res = send(uri,'HttpPost',jsonstr,ResponseMap.get('access_token')); //End point should be rest service URL
System.debug('***'+res);
}
My Post method in another org
@HttpPost
global static Map<String, List<String>> processPermSetDelegation()
{
RestRequest req = RestContext.request;
Map<String, List<String>> delegationMap= (Map<String, List<String>>) JSON.deserializeUntyped(String.valueOf(req)); //Error
system.debug(req);
return delegationMap;
//Parse and send the data to handler class
}
Error Message: RESPONSE_BODY[{"errorCode":"APEX_ERROR","message":"System.JSONException: Unexpected character ('R' (code 82)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,2]\n\nClass.System.JSON.deserializeUntyped: line 11, column 1\nClass.Method processPermSetDelegation: line 9, column 1"}]
String reqBody = req.getBody(); then JSON.deserializeUntyped() it. I think the
R` that you are getting is the first letter of the text "Request"