I searched all over but not found the right one.
My Body string below,
[{"revokePermSetNames":["RemovPerm1","RemovPerm2"],
"EmployeeNumber":"8507",
"assignPermSetNames":["AddPerm1","AddPerm2"]},
{"revokePermSetNames":["RemovPerm3","RemovPerm4"],
"EmployeeNumber":"8508",
"assignPermSetNames":["AddPerm3","AddPerm4"]}]
My Class here
@HttpPost
global static void processPermSetDelegation() {
System.debug('****'+RestContext.request);
System.debug('^^^^'+RestContext.request.requestBody.toString());
System.debug(String.valueOf(RestContext.request.params));
List<permissionDataWrapper> delegationMap = (List<permissionDataWrapper>)JSON.deserialize(RestContext.request.requestBody.toString(),permissionDataWrapper.class);
for(permissionDataWrapper cp : delegationMap) {
System.debug('------'+cp.EmployeeNumber);
for(string s: cp.assignPermSetNames )
System.debug('Assign :------'+s);
for(string a: cp.revokePermSetNames)
System.debug('Revoke :------'+a);
System.debug('------------------------------------------');
}
}
global class permissionDataWrapper {
public String EmployeeNumber {get;set;}
public Set<String> assignPermSetNames {get;set;}
public Set<String> revokePermSetNames {get;set;}
permissionDataWrapper () {
assignPermSetNames = new Set<string>();
revokePermSetNames = new Set<string>();
}
}
Error :
Malformed JSON: Expected '{' at the beginning of object
{"revokePermSetNames":"RemovPerm3","RemovPerm4"],
[
to start array.