We have JSON sent to us by webservice which has double quotes in value part (Key => Value)in the JSON String. Below is how the JSON looks like
[{
"dp_id": "SDN071076",
"list1": "Specially Designated Nationals and Blocked Persons [OFAC]",
"type": "CYBER2",
"category": "Entity",
"name": "ITSEC TEAM AKA AMN PARDAZESH KHARAZMI AKA \"IT SECURITY & PENETRATION TESTING TEAM\" AKA IT SECURITY AND PENETRATION TESTING TEAM AKA \"POOYA DIGITAL SECURITY GROUP\"",
"street1": "Unit 2, No. 129, Mir Ali Akbari St, Motahari Avenue",
"street2": "",
"city": "Tehran",
"state": "",
"country": "Iran (Islamic Republic of)",
"ctrycode": "IR",
"notes": "Additional Sanctions Information - Subject to Secondary Sanctions . [CYBER2].<BR>",
"frc": "",
"startdate": "9/14/2017",
"enddate": "12/30/2099",
"frserve": "",
"optionalid": "a011H00000VI7x8QAD",
"alerttype": "_Y"
}]
If you look at the name key in the JSON it has double quotes in the value, so we normally to deserialize to a inner class type Apex throws us below error:
Unexpected character ('I' (code 73)): was expecting comma to separate OBJECT entries at [line:1, column:55]
So we tried to replace all the occurence of \" with single quote but the Apex complier treats \" as double quotes using following code:
jsonString.replace('\\"','\'');
But above didn't not work
Is there's a way to achieve what we are trying to do in Apex?