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
Shruti NigamShruti Nigam 

How to insert data from json response

Hi all i need to create a record from json response
 
Http http = new Http();
            HttpRequest request = new HttpRequest();

            request.setEndpoint('xxxxxxxxxxxx');
            request.setMethod('POST');
         	request.setHeader( 'Content-Type', 'application/json' );
        	String JSONContent = 'xxxxxxxx';
        	request.setBody(JSONContent);
        	
            HttpResponse response = http.send(request);
        	
            if (response.getStatusCode() == 200) 
            {
                
              System.debug(response.getBody());
            }

The response i am getting is like this
 
-{
"settings" : -{
"success" : 1,
"message" : Call report return successfully. ,
"fields" : -[
call_report_id,
call_duration,
call_started_at,
call_end_at,
call_status,
call_case_id,
expert_notes,
expert_chat,
call_media_url,
call_media_status
]
},
"data" : -{
"call_detail" : -[
-{
"call_report_id" : 505usUAAQ,
"call_duration" : 00:00:03,
"call_started_at" : 2020-02-27 17:59:29,
"call_end_at" : ,
"call_status" : Waiting,
"call_case_id" : jklfgdjdklgjkldgjkldgjf,
"expert_notes" : ,
"expert_chat" : 
}
],
"call_medial" : -[
-{
"call_media_url" : ,
"call_media_status" : Pending
}
]
}
}
 i need to create a single record from above the response in a custom object.
for call_detail  and call_medial fields


Thanks in advance
MantoManto
Use https://json2apex.herokuapp.com/ to create apex class for your json response
Refer this to get an example : https://developer.salesforce.com/forums/ForumsMain?id=9062I000000XtNOQA0