function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ashu sharma 38Ashu sharma 38 

As I need the value of "Result" from JSON

Hi,

This is below my JSON,as I need the value of "Result",but i am getting null value on it.

Please have a loook:

 public static void testSynchMethod(){
       string strEmail='{\"Code\":201,\"Meassge\":\"Created\",\"Details\":\" Request: { email: bob@example.com first_name: Bob last_name: Smith }, Result: { id: 15361872, created_at: 2020-02-05T09:29:50.47Z, first_name: Bob, last_name: Smith, full_name: Bob Smith, company: null, email: bob@test.com, roles: [], avatar_url: null, bio: null, headline: null, affiliate_code: null, external_source: null, affiliate_commission: null, affiliate_commission_type: %, affiliate_payout_email: null, administered_course_ids: null, custom_profile_fields: [ { id: null, value: null, label: sso_id, custom_profile_field_definition_id: 16009 } ] } \"}';
           map<string,object> cObjMap=(map<string,object>) JSON.deserializeUntyped(strEmail);
       
        string objJSON=JSON.serialize(cObjMap.get('Details'));
        Map<String, Object> ResultParam = (Map<String, Object>)cObjMap.get('Result');
        system.debug('>>>>>>>>>>>>'+ResultParam);
        
        

JOSN---
{ "Code": 201, "Meassge": "Created", "Details": " Request: { email: bob@example.com first_name: Bob last_name: Smith }, Result: { id: 15361872, created_at: 2020-02-05T09:29:50.47Z, first_name: Bob, last_name: Smith, full_name: Bob Smith, company: null, email: bob@test.com, roles: [], avatar_url: null, bio: null, headline: null, affiliate_code: null, external_source: null, affiliate_commission: null, affiliate_commission_type: %, affiliate_payout_email: null, administered_course_ids: null, custom_profile_fields: [ { id: null, value: null, label: sso_id, custom_profile_field_definition_id: 16009 } ] } " }