2014-04-09 93 views
0
{ 
    "isSuccessful": true, 
    "resultSet": [ 
     { 
     "name": "pradeep", 
     "password": 123, 
     "timestamp": "2014-04-08T12:58:45.000Z" 
     }, 
     { 
     "name": "dileep", 
     "password": 1234, 
     "timestamp": "2014-04-08T13:00:52.000Z" 
     } 
    ] 
} 

此調用結果我已經通過使用SQL適配器,如何解析這個調用的結果,我如何從這個JSON object.Do顯示名稱,密碼,時間戳需要使用HTTP適配器有。IBM工作燈適配器解析JSON

+0

什麼是您的實際問題?一個WL適配器只是簡單的JavaScript,沒有什麼困難做... – leppie

+0

我想顯示resultSetvalues.so我該怎麼做。我應該在哪裏寫代碼。 – user3510796

回答

0

如果你想得到結果的長度,你應該使用result.invocationResult.resultSet.length,它會給你結果的總數,其中items是來自適配器的響應,invocationResult包含結果和其他參數,從中你將有訪問結果只訪問特定的output.To獲得價值通話

result.invocationResult.resultSet.name [位置]

像調用所有字段的密碼,與位置時間戳 in for循環

function handleSuccess(result) { 



    var invocationResult = result.invocationResult; 
    var isSuccessful = invocationResult.isSuccessful; 
    if (true == isSuccessful) { 
     var result = invocationResult.resultSet; 

     for (var i = 0; i < result.length; i++) { 
      alert(result.name[i]); 
          alert(result.password[i]); 
          alert(result.timestamp[i]); 
     } 

    } else { 
     alert("error"); 
    } 
+0

好的這個代碼,我需要寫它。在我的程序。 – user3510796

+0

您必須將上面的代碼寫入您的過程中successcallback函數 – prakash

+0

Im新的IBM worklight,因此可以給我一個很好的鏈接,以便我可以徹底研究worklight。 – user3510796