从 http 适配器程序读取响应

Reading response from http adapter procedure

我收到来自网络服务器的响应:

  { 
  "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": [ ]
  }

我检索真实值的代码段:

 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;
        }
    } 

如何在 适配器-impl.js 中向下钻取并仅提取 "text": "True" 中的值?

请给我一些。谢谢

你能试试这个way.one更多的东西吗,看你想要returnjson object。所以,必须写json格式或转换json .

 var response= WL.Server.invokeHttp(input);

    if (response.statusCode==200 && response.isSuccessful==true){

        var val =response.text

            return {

                data:val

            }


    }
    else{

        return null
    }