Skip to main content

HTML Table to JSON Extractor

Run it hosted, no setup: HTML Table to JSON Extractor on Apify — pay per result, nothing to install or maintain.

Extract data tables from HTML pages as clean JSON records. Each table row becomes a dictionary with keys from header cells, along with metadata about the source table.

Installation

pip install html-table-to-json-extractor-0.1.0-py3-none-any.whl

Quickstart

from html_table_to_json_extractor import process

html = """
<table>
    <tr><th>Product</th><th>Price</th></tr>
    <tr><td>Widget</td><td>$10</td></tr>
    <tr><td>Gadget</td><td>$20</td></tr>
</table>
"""

records = process(html, "http://example.com/products")
for record in records:
    print(record)

API Reference

process(html: str, url: str) -> list[dict]

Extract all HTML tables from the given HTML string as JSON-serializable records.

Parameters:

  • html: The HTML content to parse
  • url: The URL where the HTML was fetched from (used for context)

Returns: List of dictionaries, where each dictionary represents a table row with keys from header cells. Each record includes:

  • table_index: 0-based index of the table in the document
  • table_caption: The table's caption if present
  • Additional keys from header cells (converted to snake_case)

Features

  • Handles malformed HTML gracefully
  • Properly processes nested elements in table cells
  • Converts header text to snake_case for consistent keys
  • Preserves table metadata (index, caption)
  • No external dependencies (pure Python standard library)

Metadata

Release files for html-table-to-json-extractor 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for html-table-to-json-extractor 0.1.0
File Size Uploaded Provenance Actions
html_table_to_json_extractor-0.1.0.tar.gz 10.8 kB Without provenance Details for html_table_to_json_extractor-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for html-table-to-json-extractor 0.1.0
File Interpreter ABI Platform Actions
html_table_to_json_extractor-0.1.0-py3-none-any.whl Python 3 none any Details for html_table_to_json_extractor-0.1.0-py3-none-any.whl

Total release size: 18.3 kB

Release files / html_table_to_json_extractor-0.1.0.tar.gz

Download URL html_table_to_json_extractor-0.1.0.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e93ccac79ea4334395271f994981a8e1c1e33596b28767a6a3e6354672801309
BLAKE2b-256 checksum
How to use checksums
d7383867256edf5cfd64238dbbc3117a75c411f7ca2249398ba5874eb7892ce9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / html_table_to_json_extractor-0.1.0-py3-none-any.whl

Download URL html_table_to_json_extractor-0.1.0-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14015476e51788516be515f1accf4ca65b62d392fa3180e604d208cf33822d08
BLAKE2b-256 checksum
How to use checksums
646285bee581e1625f6cd5e2aeefaec0bb8182a0e1806f39b46ea89e455ed16e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Security for html-table-to-json-extractor 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page