In order to retrieve data from the server, I created a servlet that adds the data to a JSONObject and sends it back to the Dojo request.get()
function. While I am able to successfully receive the data, I am unsure of how to properly display the JSON content.
Below is my request.get()
function:
request.get("FilenetDojoServlet", {
sync: true,
timeout: 3000,
handleAs: "json"
}).then(function(data){
data4 = json.stringify(data);
console.log("Data from server : "+data4); //displaying json string of data.
console.log("List from data : "+data4.osList); //should display "osList" contained within data
});
After executing the code, this is the output displayed in the console:
Data from server : {"map":{"osList":{"myArrayList":["UDMS","EBILLING","BATELCO"]}}}
List from data : undefined
I am attempting to access the values within myArrayList
in the JSON string. I have tried the following:
var data4 = data.map.osList.myArrayList
However, this method did not yield the expected results.
Here is the JSON data in a stringified format:
{"map":{"osList":{"myArrayList":["UDMS","EBILLING","BATELCO"]}}}