0

While testing a REST service i am getting a JSON parsing exception as given below.

[
    {
        "errorCode": "APEX_ERROR",
        "message": "System.JSONException: Unrecognized character escape ''' (code 39) at [line:10341, column:31]\n\n(System Code)\nClass.GSSRestResourceUpsertStagingCustMaster.doPost: line 7, column 1"
    }
]

The actual JSON string that i used in Postman client is,

  {
    "CustomerNo": "404884",
    "PartFunc": "",
    "SalesGroupNo": "",
    "AccountOwner": "",
    "SalesOffice No": "",
    "SalesOffice": "",
    "**CustomerName": "Gavin O'brien",**
    "StreetAddr": "",
    "City": "London",
    "PostCode": "AB123CD",
    "State": "",
    "Country": "GB",
    "Telephone": "123456",
    "Fax": "",
    "Email": "[email protected]",
    "SalesOrg": "",
    "DistrChannel": "",
    "Division": "",
    "Addre ss": "Some address"
  },

Any Suggestions please.

1
  • 2
    I bet it's coming from Mr. O'brien here: "CustomerName": "Gavin O'brien", Jun 13, 2015 at 16:29

1 Answer 1

2

After you generate the JSON string, try using the String.unescapeEcmaScript() method.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .