I have to create json dynamically, which is not a problem but in one place json name and value pair are random and can also be different, so is it possible to read json.
var json = {
"set":[
{
"name":"Device 1",
"children":[
{
"name":"name",
"name1":"name",
"xyz":"hello",
"abc":"hello1",
"vwx":"hello2",
"stu":"hello3",
"children":[
{
"type1":"iname",
"type2":"cname",
"type3":"pname"
}
]
}
]
},{
"name":"Device 2",
"children":[
{
"name":"name3",
"name4":"name4",
"def":"hello2",
"lmn":"hello3",
"children":[
{
"type1":"iname",
"type2":"cname",
"type3":"pname"
}
]
}
]
}
]};
This is a part I have done to iterate data before children.But as my doubt was only for data between children that's why I have shorten the json to only limit it to the question I have asked
$(window).bind("load", function() {
var mouseX;
var mouseY;
$(document).mousemove( function(e) {
mouseX = e.pageX;
mouseY = e.pageY;
});
$.each(device_json.device, function(i, v) {
$('#front'+v.position).append(v.name);
$('#front'+v.position).hover(function(){
$('#front'+v.position).append('<div class="hover"><b>Name :</b> ' +v.name+'</div>').css({'cursor':'pointer'}).show();
$('.hover').css({'top':mouseY,'left':mouseX});
},function(){
$('.hover').remove();
});
I have to show the data between children in table form first td will be name and second will show value, but how many are there in between children is unknown and also there sequence is not same.Any help will be appreciated.Thanks in advance