Trình bao bọc Python để chuyển đổi JSON thành biểu diễn Bảng HTML có thể đọc được của con người
Ví dụ sử dụng
ví dụ 1. sử dụng cơ bản
from json2html import *
input = {
"name": "json2html",
"description": "Converts JSON to HTML tabular representation"
}
json2html.convert[json = input]
đầu ra
namejson2htmldescriptionconverts JSON to HTML tabular representation
Tên
json2html
sự miêu tả
Chuyển đổi biểu diễn dạng bảng JSON sang HTML
ví dụ 2. Đặt thuộc tính tùy chỉnh cho bảng
from json2html import *
input = {
"name": "json2html",
"description": "Converts JSON to HTML tabular representation"
}
json2html.convert[json = input, table_attributes="id=\"info-table\" class=\"table table-bordered table-hover\""]
đầu ra
namejson2htmldescriptionConverts JSON to HTML tabular representation
ví dụ 3. Clubbing cùng phím của. Mảng đối tượng
from json2html import *
input = {
"sample": [{
"a":1, "b":2, "c":3
}, {
"a":5, "b":6, "c":7
}]
}
json2html.convert[json = input]
đầu ra
samplebca231675
Ví dụ 4. Mỗi hàng cho [các] khóa khác nhau của. Mảng đối tượng
from json2html import *
input = {
"sample": [{
"a":1, "b":2, "c":3
}, {
"1a1":5, "1b1":6, "c":7
}]
}
json2html.convert[json = input]
đầu ra
sample- a1c3b2
- 1b16c71a15
Ví dụ 5. [Nguồn. json. tổ chức/ví dụ]
đầu ra
glossaryGlossDivGlossListGlossEntryGlossDefGlossSeeAlso- GML
- XML
paraA meta-markup language, used to create markup languages such as DocBook.GlossSeemarkupAcronymSGMLGlossTermStandard Generalized Markup LanguageAbbrevISO 8879:1986SortAsSGMLIDSGMLtitleStitleexample glossary
jQuery tương tác với HTML DOM để thao tác các phần tử HTML. Bài viết này cung cấp hướng dẫn quy trình để chuyển đổi dữ liệu JSON sang bảng HTML bằng JavaScript/jQuery
Dữ liệu JSON chuyển đổi thành Bảng HTML như thế nào?
Firstly, of all, a document form is created with tag, in which an HTML table is created with