I have a response from a web server:
{
"errors": [ ],
"info": [ ],
"isSuccessful": true,
"responseHeaders":
{
"Connection": "close",
"Content-Length": "159",
"Content-Type": "text\/html",
"Date": "Sat, 20 Feb 2016 11:15:35 GMT",
"Server": "Apache",
"X-Powered-By": "PHP\/5.2.17" },
"responseTime": 705,
"statusCode": 200,
"statusReason": "OK",
"text": "True \n<!-- Hosting24 Analytics Code -->\n<script type=\"text\/javascript\" src=\"http:\/\/stats.hosting24.com\/count.php\"><\/script>\n<!-- End Of Analytics Code -->",
"totalTime": 706,
"warnings": [ ]
}
My snippet to retrieve the true value:
var response = WL.Server.invokeHttp(input);
// Extract value from the response.
var type = typeof response;
if ("object" == type) {
if (true == response["isSuccessful"]) {
// Drill down into the response object.
var results = response["results"];
var result = results[0];
var val = result["text"];
// Return JSON object
return val;
}
else {
// Returning null. Web request was not successful.
return null;
}
}
How to drill down and extract only the value from the "text": "True"
in the adapter-impl.js??
Can I have some please. Thanks.