I am converting JSON data into a list structure, and I want to save the "AAA.BBB[0].CCC.DDD[5].EEE" format as the id so when a user modifies the content of that list item it modifies the JSON data associated with that location.
For Example AAA.BBB[0].CCC.DDD[5].EEE = 123
123 is a list item but I want the id to be saved as "AAA.BBB[0].CCC.DDD[5].EEE"
Would there be a better way to save the location in the id?
*Edit:
Sample Code:
JSON DATA: {"AAA":{"AAB":"Value1","AAC":"Value2","AAD":1,"AAE":"Value3","AAF":"{"ABC": "Value4"}}}
Soo the id for list item "Value4" would be AAA.AAF.ABC
function nodeIT(obj,output){
for (var x in obj){
if(!(obj[x] instanceof Object)){
//var str =JSON.stringify(obj); // Where im stuck!
output +="<li id='"+str+x +"'>";
output += (x + "=" + obj[x] + "<br />");
output +="</li>";
}
else if((obj[x] instanceof Object)){
var obj1 = obj[x];
output+="<li>" +x + "<ul>";
output=nodeIT(obj1,output);
}
}
output += "</ul></li>";
return output;
}