--- id: html-to-json version: "3.0.0" license: MIT License license_treatment: permissive maintenance: active --- # html-to-json — Convert html to json. License: permissive · Maintenance: active · Downloads: 321.9K/mo ## What it is and what it does html-to-json is a Python library that transforms HTML markup into JSON structures. It provides two main conversion functions: one for general HTML documents that preserves element hierarchy, attributes, and text content, and another specialized for HTML tables that intelligently extracts rows and columns into JSON objects keyed by header names. The library depends on beautifulsoup4 for HTML parsing and supports modern Python versions from 3.10 onward. The package handles three common table patterns: headers in the first row, headers in the first column, or no headers at all. For both HTML and table conversion, you can control what gets captured—text values, attributes, nested tags as inner HTML, or nested tags as structured JSON—via keyword arguments. This makes it useful for web scraping workflows, data extraction pipelines, and converting HTML reports into machine-readable formats. Use it for: - Extract structured data from HTML tables on web pages and convert to JSON for further processing. - Parse HTML documents from web scraping operations and transform into JSON for storage or API responses. - Convert HTML-based reports or exports into JSON format for integration with downstream data pipelines. - Preserve HTML attributes and nested link structures when extracting table data by using record_html or record_children options. - Build data ingestion tools that accept HTML input and output standardized JSON for consumption by other services. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts HTML documents and HTML tables into JSON structures, optionally capturing element attributes, text values, and nested tags. Yes. The package is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a concrete problem—converting HTML to JSON—with a straightforward API. It's suitable for production use in web scraping and data extraction workflows where HTML tables or documents need to become JSON. ## Install pip install html-to-json uv add html-to-json poetry add html-to-json ## Installing html-to-json Before you install: Low friction installation with a single runtime dependency (beautifulsoup4). The package is actively maintained with a recent release and no known vulnerabilities. License in practice: MIT License permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely as long as you include the license notice. Quickstart: pip install html-to-json import html_to_json html_string = "Test" output_json = html_to_json.convert(html_string) print(output_json) Requires Python 3.10 or later. Verify before relying: - Performance characteristics when processing large HTML documents or tables with many rows. - Behavior with malformed or non-standard HTML input. - Memory usage patterns for deeply nested HTML structures. ## Package facts - License: MIT License (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 321.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags html to json conversion, parse html as json, html table to json, extract html structure json, html scraping json output, convert html markup json, html parsing library, html-parsing, data-extraction, web-scraping [View on SkillFed](https://skillfed.io/packages/html-to-json) · [View on PyPI](https://pypi.org/project/html-to-json/)