Free tool
HTML to DOM JSON
The document as a tree: tag, attributes, children, all the way down. Advanced, verbose, and occasionally exactly what you need.
HTML input
JSON output
0 B · 0 linesExtracted locally in your browser — nothing is uploaded.
How it works
What this tool does
- Depth cap from 3 to 25 levels — nodes beyond it are marked truncated instead of blowing up the payload.
- Text nodes can be plain strings (compact) or wrapped nodes (uniform to walk).
- Scripts and styles are stripped by default; keep them when you are reverse-engineering a page's behaviour.
- Most of the time you want Structured or Schema mode instead — the DOM is the internal representation, not the data.
With Irmu
When you also need to fetch the page
A browser cannot fetch arbitrary URLs. Irmu returns the HTML — rendering, proxies and retries included — and you run the same extraction over it.
crawl_and_extract.py
# 1. Fetch the page with Irmu — rendering, proxies and retries handled for you
# 2. Extract the fields you need locally
import os, json, requests
from bs4 import BeautifulSoup
resp = requests.get(
"https://app.irmu.com/api/crawl",
headers={"Authorization": f"Bearer {os.environ['IRMU_API_KEY']}"},
params={"url": "https://store.example.com/products/acme-headphones", "render": "true"},
timeout=60,
)
resp.raise_for_status()
soup = BeautifulSoup(resp.text, "html.parser")
data = {
"name": soup.select_one("h1").get_text(strip=True),
"price": soup.select_one(".price").get_text(strip=True),
"reviews": [r.get_text(strip=True) for r in soup.select(".review")],
}
print(json.dumps(data, indent=2))Code examples
Do the same thing in your own pipeline
The equivalent extraction with the standard HTML parser in each language.
# pip install beautifulsoup4
import json
from bs4 import BeautifulSoup
soup = BeautifulSoup(html, "html.parser")
def to_node(el, depth=0, max_depth=6):
node = {"tag": el.name}
if el.attrs:
node["attrs"] = {k: (" ".join(v) if isinstance(v, list) else v) for k, v in el.attrs.items()}
if depth >= max_depth:
return node
children = []
for child in el.children:
if getattr(child, "name", None):
children.append(to_node(child, depth + 1, max_depth))
elif child.strip():
children.append(child.strip())
if children:
node["children"] = children
return node
data = to_node(soup.body)
print(json.dumps(data, indent=2))FAQ
Questions about this tool
Turn any URL into clean JSON
Fetch, render and extract with one API. 1,000 free credits every month, no card required.