Activity Forums Salesforce® Discussions "currency" in json Response but while deserializing Reserved Word Exception is shown in Salesforce?

  • "currency" in json Response but while deserializing Reserved Word Exception is shown in Salesforce?

  • Suraj

    Member
    April 27, 2017 at 1:47 pm

    "Currency" keyword is used as key in json Response but when i am passing to deserialize Reserved Word Exception is shown?

    How to handle this Exception?

  • Saurabh

    Member
    April 27, 2017 at 2:37 pm

    Hi Suraj

    Perform a string replace on the json string, the implications of this is unintended replacement of valid text inside a string, but this could be mitigated if the form of the json is as you've supplied "currency": "ABC" you could string replace:

    jsonString.replace('"currency":', '"currency_x":');

    Hope it may help you:

  • Avnish Yadav

    Member
    September 30, 2018 at 4:21 am

    Hello,

    You have two choices: JSON.deserializeUntyped or JSON.createParser. But if still find error, Please share the code.

    Thanks.

Viewing 1 - 3 of 3 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos