I've created a JSON object which has two arrays in it. I've searched all over the web on how to extract the data but all the code I've tried has either returned "undefined" or [object object].
Can you please look at my example and show me how I would do this?
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="NPP-Plugin">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<div id="file"></div>
<div id="applicID"></div>
<script type="text/javascript">
var IETMObj = {
"allItems": [{
"sFile": "Test.html",
"Applicability": [{ // second dimension
"ApplicID": "subj_1",
"ApplicDisp": "Driving",
"Condition": "In rain"
},{
"ApplicID": "subj_2",
"ApplicDisp": "Running",
"Condition": "Uphill"
}]
}]
};
for (var i = 0; i < IETMObj.length; i++){
document.write("<br><br>array index: " + i);
var obj = IETMObj[i];
for (var key in obj){
var value = obj[key];
document.write("<br> - " + key + ": " + value);
}
}
</script>
</body>
</html>