{"id":4064,"library":"json2html","title":"json2html","description":"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.","status":"active","version":"1.3.0","language":"en","source_language":"en","source_url":"https://github.com/softvar/json2html","tags":["json","html","table","conversion","web"],"install":[{"cmd":"pip install json2html","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"note":"While 'from json2html import *' is often seen, importing the 'json2html' class explicitly is clearer.","symbol":"json2html","correct":"from json2html import json2html"}],"quickstart":{"code":"from json2html import json2html\n\njson_data = {\n    \"name\": \"Alice\",\n    \"details\": [\n        {\"age\": 30, \"city\": \"New York\"},\n        {\"age\": 25, \"city\": \"London\"}\n    ]\n}\n\nhtml_output = json2html.convert(json=json_data, table_attributes=\"id=\\\"info-table\\\" class=\\\"table table-bordered\\\"\")\n\nprint(html_output)","lang":"python","description":"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."},"warnings":[{"fix":"Ensure your input is a Python object: `import json; data_obj = json.loads(json_string); html = json2html.convert(json=data_obj)`.","message":"The 'json' parameter of the `convert` method expects a Python dictionary or list, not a JSON string. If you have a JSON string, you must parse it first using `json.loads()`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Pass `escape=False` to the `convert` method: `json2html.convert(json=my_data, escape=False)`.","message":"By default, HTML tags within text nodes are escaped to prevent Cross-Site Scripting (XSS) attacks. If you intend to render raw HTML content within your JSON values, you must explicitly disable escaping.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Pass `clubbing=False` to the `convert` method: `json2html.convert(json=my_data, clubbing=False)`.","message":"When a JSON value is an array of objects with identical keys, `json2html` will 'club' them together into a single row by default for a more compact representation. If you need each object in the array to generate a separate row, you must disable this feature.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}