I can’t change json format. The data store in new line.
json file:
{"ProgMode":"on","wait_h":"5","wait_m":"5","output":"1"}
{"ProgMode":"off","wait_h":"10","wait_m":"10","output":"2"}
I using below code but without bracket ([]) in json file, it doesn’t work.
var ReqJson = new XMLHttpRequest();
function response(){
if(this.readyState == 4 && this.status == 200){
var myObj = JSON.parse(this.responseText);
const dbParam = JSON.stringify({table:"ProgramView",limit:20});
let text = "<table class='table my-0'>"
for (let x in myObj) {
text += '<tr><td>' + myObj[x].wait_h + ':' + myObj[x].wait_m + ':' + myObj[x].output + '</td></tr>';
}
text += "</table>"
document.getElementById("dynamic_table").innerHTML = text;
}
}
function ProccessConfig(){
ReqJson.open("POST", "Programs.json", true);
ReqJson.onreadystatechange = response;
ReqJson.send()
}
ProccessConfig();
So how can I parse json that is stored with new lines and without comma and brackets?