Here is my request json.
{
"apply_header":" CER202208170008",
"sn":"CERL202208170008",
"cert_cat":"MCS",
"cert_name":"MCS",
"prod_attr":"test",
"prod_name":"DEG9.28",
"power":390405,
"component_size":"1170x1096x30",
"cert_no":"N8AUK 070321 0135",
"effective_start_date":"24/4/2022",
"ffective_end_date":"24/4/2023",
"status":"success"
}
The error is
System.TypeException: Invalid conversion from runtime type Map<String,ANY> to List Class.TS_Phase2_ProductCertificationToSFDC.doPost: line 13, column 1
Here is my error code. i want to deserialize json the insert the data to salesforce. The first line is the error line
list<Object> dataList = (list<Object>)JSON.deserializeUntyped(jsonStr);
for(Object objData : dataList){
Map<String, Object> dataObjectMap = (Map<String, Object>)objData;
if(dataObjectMap != null && dataObjectMap.size() > 0){
TS_Product_Certification__c oneProductC = new TS_Product_Certification__c();
for(Interface_Field_Mapping__c ifm:fieldList){
if(dataObjectMap.get(ifm.TS_Interface_Field__c) != null){
try {}catch{}
}
}
{
so is an object, not an array. You therefore need to useMap<String, Object>
as the type for this untyped deserialization.