+ Start a Discussion
Girish Reddy 52Girish Reddy 52 

Can anyone please help me with de-serializing, I want to take Json values and map to my fields. I wrote a wrong code but unable to identify my mistake

I think I made mistake in de-serializing & didnot use the map correctly. But not sure how to correct it. Yout help will be really appreciated 
    global static void doPost() 
         RestRequest req = RestContext.request;
        RestResponse res = Restcontext.response;       
        String requestJson = req.requestBody.toString();
        map<String, Object> jsonMap = (map<String, Object>) JSON.deserializeUntyped(requestJson);
        String Name = String.valueof(jsonMap.get('Name'));
        String Gender = String.valueof(jsonMap.get('Gender'));
        String Email = String.valueof(jsonMap.get('Email'));        
AnkaiahAnkaiah (Salesforce Developers) 
Hi Girish,

Please refer the below link for json de-serializing into map

If this helps, Please mark it as best answer.