Activity Forums Salesforce® Discussions How to get the reserved words used in Json Body in Salesforce?

  • Radhakrishna

    Member
    April 25, 2017 at 10:48 am

    You can use JSON class.

    If you have a model you can use JSON.deserialized Ex

    String myJson = '{name="Test",phone="1234567890"}';
    Account ac = (Account) JSON.deserialize(myJson, Account.class);

    If you dont want use a model then you can use JSON.deserializeUntyped Ex:

    String myJson = '{name="Test",phone="1234567890"}';
    Map<String,Object> ac = JSON.deserializeUntyped(myJson);
    System.debug(ac.get('name'));
    System.debug(ac.get('phone'));

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos