Hello! There is a JSON file (you can change it to solve the problem). It contains settings and data for automatic form filling. The form ID and name are taken from scID and csName respectively. In locAct is an array with a variable number of elements. The amount of remDevX with its arrays can also be different. Each object is, so to speak, a complete block with data belonging only to the form with ID = scID, the actual question:
- How to work with one json object (data prisoners between {...}) and only take data from it?
- How to take data from an array in this object?
- How then to move to another object and work with data only in it?
function loadScpts(){ // загрузка сценариев document.getElementById('parentScripts').innerHTML = ''; // Очищаем поле для сценариев var xhttp = createXmlHttpObject(); // Создаем объект xhttp.open('GET','/scpt.json?'+Math.floor(Math.random()*10000),true); xhttp.send(null); // читаем файл scpt.json xhttp.onload = function(e){ var scpt = JSON.parse(xhttp.responseText); // Полученные данные записывает в переменную scpt for(var key in scpt){readScpt(scpt[key]);} } load(); } function readScpt(object){ var jsonData = object; console.log(jsonData); var divScpt = document.createElement("div"); divScpt.id = "scID"+jsonData.scID; divScpt.innerHTML = "<fieldset><legend>"+jsonData.scName+"</legend>"+ "<table><tbody id=\"scTabl"+cntSc+"\">"+ "<tr><td colspan=\"2\"><select class=\"select w100\"></select></td></tr>"+ "<tr id=\"scDev"+cntDev+"\">"+ "<td><select class=\"select w100\"><option>RemDev</option></select></td>"+ "<td id=\"itAct"+cntAct+"\"><div id=\"act"+Act+"\"><select class=\"select w85\"><option>"+Act+"</option></select><input class=\"btn w15\" onclick=\"return addAct("+cntAct+")\" type=\"button\" value=\"+\"></div></td>"+ "</tr>"+ "</tbody></table>"+ "<input value=\"{{LangAddDev}}\" class=\"btn w85\" onclick=\"return addDev("+cntSc+")\" type=\"button\">"+ "<input value=\"{{LangDel}}\" class=\"btn w45\" onclick=\"return delEl(this)\" type=\"button\">  "+ "<input value=\"{{LangSave}}\" class=\"btn w45\" onclick=\"return saveScpt("+divScpt.id+")\" type=\"button\"></fieldset>"; document.getElementById("parentScripts").appendChild(divScpt); load(); return false; } 
var data = JSON.parse(json). The rest of your task is either incorrectly formulated or too broad. There is a million and one way to display object data in a GUI form. - vp_arthfor incode to the question. - IgoraddScpt:addScpt(scpt[key]);- Igor