AnsweredAssumed Answered

How to update values in embedded JSON in XML

Question asked by swathib on May 21, 2018
Latest reply on May 22, 2018 by gajsr01

Trying to update values in a embedded JSON in xml using request XML


1. Created test case and reading request XML file.
2. From the request xml, Parse request attributes.
3. Copied response xml in String object.

4. Response xml should is static with some dynamic values from the request.

 

String string = "<soapenv:Body>\n" + 

"        <ns2:pp xmlns:ns2=\"http://service.***.com/\">&lt;![CDATA[\n" + 

"{\n" + 

"  \"response\" : {\n" + 

"    \"lise\" : [ {\n" + 

"      \"key\" : {\n" + 

"        \"id\" : \"111111:******\"\n" + 

"      },\n" + 

"      \"data\" : {\n" + 

"        \"startDate\" : \"2017-03-10\",\n" + 

"        \"endDate\" : \"2017-10-05\",\n" + 

"      },\n" + 

"    } ]\n" + 

"  }\n" + 

"}\n" + 

"]]&gt;</ns2:pp>\n" + 

"    </soapenv:Body>";

Here 111111, startDate and endDate values should be updated using request values. Parsed request xml and extracted values. Copied response xml in String object and trying to update values using {{startDateValue}}. But values are not printing when return string object in my test case.

Please help me on this?

Outcomes