To help you visualize a JSON structure, indent at the curly brackets, and put a carriage return at every comma like this:
{
"CheckBackendResponse":
{
"xmlns":"http://tempuri.org/"
,"CheckBackendResult":"
{
\"status\":\"Success\"
,\"message\":\"valid\"
,\"responseId\":\"5b97b9ea7aaf613ec45b61a2\"
}"
}
}
I see a problem though. The value at "CheckBackendResult" is surrounded by quotes. That screws everything up.
So do this:
1) Convert the JSON string into an object, then assign the value for key "CheckBackendResult" in a new string.
Te complete string: s_resp = {"CheckBackendResponse":{"xmlns":"http://tempuri.org/","CheckBackendResult":"{\"status\":\"Success\",\"message\":\"valid\",\"responseId\":\"5b97b9ea7aaf613ec45b61a2\"}"}}
var j_resp = JSON.parse(s_resp); //This converts the JSON string into an object in a new variable, "j_resp"
var s_result = j_resp.CheckBackendResponse.CheckBackendResult;
//now s_result == "{\"status\":\"Success\",\"message\":\"valid\",\"responseId\":\"5b97b9ea7aaf613ec45b61a2\"}"
2) Remove the backslash escape characters in the new string
s_result = s_result.replace("\",""); //this will strip out all of the back slashes in the string
3) convert the new string into a JSON object
j_result = JSON.parse(s_result);
4) Reference your values in j_result
var s_status = j_result.status; //now s_status = "success"
Good luck with this complicated string, and Happy coding!
------------------------------
Todd McCall
Bank of America
------------------------------
Original Message:
Sent: 09-12-2018 05:35
From: Deepti Srivastava
Subject: Not able to read web service /web request output from Genestys composer voice application
Hi Team,
Customer has provided us https API URl for composer voice application integration.
we have tried to use directly thuis URL in https request block .its showing us SSL error.
so now we have developed a .net middleware application.now we are comsuming customer provided https API URl in our application.
and we uae this middleware web servixe URL in web service block.in we service block.when we put output map false get black response.when we make it true. get json response.
2018-09-11T18:19:48.372 Int 50035 006C01B9-1001D989 364312896 log Webservice response is {"CheckBackendResponse":{"xmlns":"http://tempuri.org/","CheckBackendResult":"{\"status\":\"Success\",\"message\":\"valid\",\"responseId\":\"5b97b9ea7aaf613ec45b61a2\"}"}}
In the above json response we are unable to parse status , message , responseId value .
Whenever we are trying to assign to composer variables it shows blank .
Response from Middleware application :
<string xmlns="http://tempuri.org/">
{"status":"Success","message":"valid","responseId":"5b98d0bf9a5d243b0c8c49f1"}
</string>
Response when output is seen in Composer logs
{"CheckBackendResponse":{"xmlns":"http://tempuri.org/","CheckBackendResult":"{\"status\":\"Success\",\"message\":\"valid\",\"responseId\":\"5b97a94f7aaf613ec45b616d\"}"}}
------------------------------
Deepti Srivastava
AGC networks Australia Pty Ltd
------------------------------