I have a JSON file
{
"Scenario" : "ModelNameHere",
"id" : "1",
"description" : "Description of table model goes here",
"headers" : {
"Column 1 header" : {
"order" : 1,
"items" : {
"Row 1 Col 1 value" : {
"id" : 1,
"comment" : "Comment on Row 1 Col 1",
"order" : 1
},
"Row 2 Col 2 value" : {
"id" : 2,
"comment" : "Comment on Row 2 Col 2",
"order" : 2
}
}
},
"Column 2 header" : {
"order" : 2,
"items" : {
"Row 1 Col 2 value" : {
"id" : 3,
"comment" : "Comment on Row 1 Col 2",
"order" : 1
},
"Row 2 Col 2 value" : {
"id" : 4,
"comment" : "Comment on Row 2 Col 2",
"order" : 2
}
}
}
}
}
I want to use jQuery to put the JSON data into an HTML table.
Headers should go inside TH td items, items inside headers should be elements in the TD of each related row.
Is there a function in either JS or jQuery to populate a table with JSON data?
How would I loop through and match JSON elements to table elements?
Thanks.