I saw that we can't pass the Map<String,List<String>> to REST post method. So I decided to go with the json as like below. Will REST allow to post this similar json to REST?

    'Emp01' : 'XXXX',
    'PermissionSetName' : { 'PermissionSet1:True',
        'Emp02' : 'XXXX',
        'PermissionSetName' : { 'PermissionSet1:False',
  • Please add one more { backet, so that JSON format gets correct first. Try & let me know – user4567570 May 17 '17 at 10:07

Send a proper json to handle or normalise it in server side


send json like below format

"status": "Pending",
"listName": "Signed Confis",
"deal": "R23WDS23FEWS32WQS",
"notes": "",
"contacts": [
    {"con": "23EWDD23RD23","primary": true},
    {"con": "1D12EDX23D33","primary": false}

Server side

public without sharing class YourClassName { 

    public class FormData {
        public String status;
        public String listName;
        public String deal;
        public String notes;
        public ContactObj[] contacts;       

    public static String[] saveAddInvestorDeal(String jsonStr){
       FormData data = (FormData) JSON.deserialize(jsonStr, YourClassName.FormData.class);      
       Opportunity opp = [Select RecordType.Name from Opportunity where id=:data.deal][0];
  • Don't you think that class and method should be global. And also have some urlMapping and @HttpPost. If you could add that, then it would be much better. – Rohit Mourya May 17 '17 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.