Free tool
HTML to JSON
Paste HTML, get JSON. Structured page data by default — metadata, headings, links, images, tables, lists, JSON-LD, text and Markdown — plus schema extraction, AI-ready output and a raw DOM tree when you need them.
HTML input
JSON output
0 B · 0 linesExtracted locally in your browser — nothing is uploaded.
How it works
What this tool does
- Structured is the default because it is what most people actually want: the content of the page, not its internal representation.
- Schema mode turns a handful of CSS selectors into exactly the JSON shape you asked for — no post-processing.
- AI-ready mode chunks the page by heading and emits Markdown plus metadata, sized for embeddings and RAG.
- DOM mode is there when you genuinely need the tree, with a depth cap so the output stays inspectable.
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")
data = {
"title": soup.title.get_text(strip=True) if soup.title else None,
"description": (soup.find("meta", attrs={"name": "description"}) or {}).get("content"),
"headings": {
f"h{level}": [h.get_text(strip=True) for h in soup.find_all(f"h{level}")]
for level in range(1, 4)
},
"links": [
{"text": a.get_text(strip=True), "href": a["href"]}
for a in soup.select("a[href]")
],
"images": [{"src": i.get("src"), "alt": i.get("alt", "")} for i in soup.find_all("img")],
"jsonld": [
__import__("json").loads(s.string)
for s in soup.select('script[type="application/ld+json"]')
if s.string
],
}
print(json.dumps(data, indent=2))Schema mode
Extract only the fields you need
Name a field, point it at a CSS selector, get exactly that shape back. Here is the same idea in code.
# pip install beautifulsoup4
import json
from bs4 import BeautifulSoup
soup = BeautifulSoup(html, "html.parser")
schema = {
"name": ("h1", False),
"price": (".price", False),
"availability": (".stock", False),
"reviews": (".review", True),
}
data = {}
for field, (selector, is_list) in schema.items():
nodes = soup.select(selector)
if is_list:
data[field] = [n.get_text(strip=True) for n in nodes]
else:
data[field] = nodes[0].get_text(strip=True) if nodes else None
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.