Reputation: 41
I am having a problem when using json2html https://github.com/eisenbraun/columns library . Is it possible to use this js library with Json object as below.
var jsonobj = [{
"id": "31",
"Mesial": {
"disorder": "",
"other": ""
},
"Facial": {
"disorder": "DC-HP",
"other": ""
},
"Distal": {
"disorder": "",
"other": ""
},
"Lingual": {
"disorder": "",
"other": ""
},
"Occlusal": {
"disorder": "",
"other": ""
}
}, {
"id": "37",
"Mesial": {
"disorder": "",
"other": ""
},
"Facial": {
"disorder": "RE-AR",
"other": ""
},
"Distal": {
"disorder": "",
"other": ""
},
"Lingual": {
"disorder": "",
"other": ""
},
"Occlusal": {
"disorder": "",
"other": ""
}
}]
I have used online tool Convert JSON to HTML Table, but unfortunately it's library is not available.
expected table output is
Upvotes: 0
Views: 495
Reputation: 10922
No, your data format is incorrect.
Your format need to respect their data format of :
[{"col1":"row1", "col2":"row1", "col3":"row1"}, {"col1":"row2", "col2":"row2", "col3":"row2"}]
Having for each object a colX:rowY
format.
So you can't have an object as a row entry.
Upvotes: 2