[英]json object to html table conversion using json2html
使用json2html https://github.com/eisenbraun/columns庫時出現問題。 是否可以將這個js庫與Json對象一起使用,如下所示。
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": ""
}
}]
我使用了在線工具“ 將JSON轉換為HTML表” ,但不幸的是它的庫不可用。
預期表輸出為
不,您的數據格式不正確。
您的格式需要遵循以下數據格式:
[{"col1":"row1", "col2":"row1", "col3":"row1"}, {"col1":"row2", "col2":"row2", "col3":"row2"}]
每個對象都有colX:rowY
格式。
因此,您不能將對象作為行條目。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.