json2html

1.3.0 · active · verified Sat Apr 11

json2html is a Python wrapper designed to convert JSON objects into human-readable HTML table representations. It provides functionalities to transform nested JSON structures into styled HTML tables. The current version is 1.3.0, and while updates are infrequent, it remains an active and functional library for its intended purpose.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to convert a Python dictionary (representing JSON data) into an HTML table string using the `json2html.convert` method. It also shows how to apply custom HTML attributes to the generated table.

from json2html import json2html

json_data = {
    "name": "Alice",
    "details": [
        {"age": 30, "city": "New York"},
        {"age": 25, "city": "London"}
    ]
}

html_output = json2html.convert(json=json_data, table_attributes="id=\"info-table\" class=\"table table-bordered\"")

print(html_output)

view raw JSON →