Shweta Soparkar Shweta Soparkar - 2 months ago 7
reST (reStructuredText) Question

How to pass a value JSON String

This is a line in my JSON file

"sfdc_id": "**********"

parsed to====> \"sfdc_id\": \"************\"

I want this to except the value dynamically.

"sfdc_id": "c[0].Id"

I now want to pass the value of id dynamically.

How can I do it?

Answer
String example='\"reg_citizenship\": null,'+
    '            \"synch\": null,'+
    '            \"reg_portalaccess\": false,'+
    '            \"sfdc_id\": \" ' 
                  +  c.Id  + 
    '               \"  '+
    '        }';

This is how I added the value dynamically to JSON String