How I can parse JSON response inside my javascript code? After I invoke my worklight adapter, I got this result.
{"linkAccountList": [{
"accountRule": "1",
"accountCurrencyISO": "IDR",
"nickName": "",
"accountCurrency": "016",
"accountTypeDisplay": "",
"accountType": "",
"accountNo": "1001328000",
"accountHolderName": "LELY HERNAWATI"
}, {
"accountRule": "1",
"accountCurrencyISO": "IDR",
"nickName": "",
"accountCurrency": "016",
"accountTypeDisplay": "",
"accountType": "",
"accountNo": "30000000100677",
"accountHolderName": "LELY HERNAWATI"
}, {
"accountRule": "1",
"accountCurrencyISO": "IDR",
"nickName": "",
"accountCurrency": "016",
"accountTypeDisplay": "",
"accountType": "",
"accountNo": "2003500382",
"accountHolderName": "LELY HERNAWATI"
}]
}
Then I store the value inside sessionStorage.
sessionStorage.setItem("linkAccountList", result.invocationResult.linkAccountList);
After that I alert the value, it's not what I wanted even already JSON.stringify()
it.
linkAccountList :: "[object Object],[object Object],[object Object]"
What I want is exactly like result above.
My success function
function welcomeSuccess(result){
WL.Logger.debug("List retrieve success");
busyIndicator.hide();
sessionStorage.setItem("linkAccountList", result.invocationResult.linkAccountList);
WL.Logger.debug("linkAccountList :: " + JSON.stringify(sessionStorage.linkAccountList));
}