HTML to JSON Smart Parser — Pages, Tables & Links
Pricing
from $2.40 / 1,000 result parseds
HTML to JSON Smart Parser — Pages, Tables & Links
Convert HTML to JSON from URLs, pasted HTML or files: headings, links, tables, JSON-LD and custom fields. No API key needed. USD 3 per 1,000 records.
Pricing
from $2.40 / 1,000 result parseds
Rating
0.0
(0)
Developer
Muhammad Afzal
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
22 days ago
Last modified
Categories
Features
Share
HTML to JSON Smart Parser converts web pages, pasted HTML, or HTML files into one clean JSON record per source, with the title, headings, paragraphs, links, images, tables, emails, phone numbers, meta tags, JSON-LD, and any custom fields you name, for developers, analysts, and AI pipelines. It costs USD 3 per 1,000 parsed records on the FREE pricing tier (USD 0.003 per record) plus a start fee of under one cent per run, and it needs no API key.
The default engine is rule-based and needs no selectors. An optional AI mode reshapes each page into your own JSON layout using an AI model API key that you supply.
What does the HTML to JSON parser return?
Every page URL, pasted HTML block, or HTML file becomes one record.
| Field | What it contains |
|---|---|
url, sourceType | Where the HTML came from (url, htmlContent, or htmlFileUrl); url is null for pasted HTML |
title, description | Page title and meta description |
favicon, canonical | Absolute favicon and canonical URLs, or null |
headings | Up to 30 h1–h6 headings as { level, text } |
paragraphs | Up to 30 paragraph texts |
links | Up to 50 links as { text, href, internal } |
images | Up to 30 absolute image URLs |
tables | Up to 5 tables as { headers, rows }, 100 rows each |
emails, phones | Up to 20 of each, from links and page text |
metaTags, jsonLd | Up to 40 meta tags and 10 parsed JSON-LD blocks |
custom | One value per field you list in fieldsToExtract |
extracted | AI mode only: the JSON object shaped to your fields or schema; otherwise null |
mode, error, scraped_at | Engine used (heuristic or ai), an error note or null, and a timestamp |
How do I convert HTML to JSON without writing a parser?
Give it a source and, optionally, the fields you care about. One run can mix all three source types.
- Page URLs (
startUrls): public pages to fetch and parse. - Pasted HTML (
htmlContent): raw HTML from emails, exports, or pages you cannot reach publicly. - HTML file URLs (
htmlFileUrls): exported or archived.htmlfiles, including files uploaded in Apify Console.
fieldsToExtract takes a comma-separated list such as title, price, availability. Built-in recipes cover title, description, price, author, date, image, rating, availability, sku, brand, manufacturer, canonical, and keywords, using microdata, meta tags, and common class names. Any other name is looked up in matching meta tags, name, id, class, and data- attributes.
{"startUrls": [{ "url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html" }],"fieldsToExtract": "title, price, availability","mode": "heuristic","maxResults": 100}
maxResults (1–10,000, default 100) caps the records per run. If you leave every source empty, the Actor parses the books.toscrape.com home page so the run still succeeds.
What does AI mode add?
AI mode sends each page's visible text (up to maxContentChars, default 20,000 characters) to a hosted AI model with your own API key, and returns JSON that matches your fieldsToExtract list or a sample outputSchema such as {"title":"string","price":"number","inStock":"boolean"}. Set mode to ai, or leave it on auto and add your key. Choose model: "standard" (fast, low token cost) or "advanced" (complex pages). Model usage is billed to your key by its provider.
autowithout a key returns the rule-based result at the normal price.aiwithout a key is rejected before any charge.- If the AI call fails for a page, the record keeps the rule-based result with an
errornote and is not charged. A rejected key, unknown model, invalid request or exhausted quota stops the run after that record.
When should you use it, and when not?
Use it for:
- turning product, article, or listing pages into predictable JSON without writing selectors;
- converting exported HTML reports, email bodies, and archives into database rows;
- pulling HTML tables into JSON arrays, and JSON-LD or meta tags out of pages;
- feeding AI agents and pipelines a compact, structured view of a page.
Do not use it when:
- The page builds its content with JavaScript. Pages are fetched as static HTML and scripts are not run.
- You want plain-English field extraction without your own key. Use AI Web Scraper — Extract Website Data to Structured JSON.
- You need retrieval-ready text chunks. Use RAG Chunking Crawler — Web Pages to Text Chunks.
- The text is inside an image. Use Extract Text from Image URLs — Image OCR Scraper.
Use it from an AI assistant
HTML to JSON Smart Parser works from Claude, ChatGPT, Cursor, or any other MCP client through Apify's MCP server. Add https://mcp.apify.com/?tools=muhammadafzal/html-to-json-smart-parser to your client and ask, for example: "Convert these five product pages to JSON and give me each title, price, and availability."
Run it with the API
JavaScript (apify-client):
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: process.env.APIFY_TOKEN });const run = await client.actor('muhammadafzal/html-to-json-smart-parser').call({startUrls: [{ url: 'https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html' }],fieldsToExtract: 'title, price, availability',mode: 'heuristic',});const { items } = await client.dataset(run.defaultDatasetId).listItems();console.log(items[0].custom, items[0].tables);
Python (apify-client 3.x):
import osfrom apify_client import ApifyClientclient = ApifyClient(os.environ["APIFY_TOKEN"])run = client.actor("muhammadafzal/html-to-json-smart-parser").call(run_input={"htmlContent": "<html><body><h1>Invoice 42</h1><a href='mailto:billing@example.com'>Billing</a></body></html>", "mode": "heuristic"})for record in client.dataset(run.default_dataset_id).iterate_items():print(record["headings"], record["emails"])
Output example
From the default input, run on 2026-10-26 (arrays and long text shortened):
{"url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html","sourceType": "url","title": "A Light in the Attic | Books to Scrape - Sandbox","description": "\n It's hard to imagine a world without A Light in the Attic. …","favicon": "https://books.toscrape.com/static/oscar/favicon.ico","canonical": null,"headings": [{ "level": "h1", "text": "A Light in the Attic" },{ "level": "h2", "text": "Product Description" },{ "level": "h2", "text": "Product Information" }],"paragraphs": ["£51.77", "In stock (22 available)", "It's hard to imagine a world without A Light in the Attic. …"],"links": [{ "text": "Books to Scrape", "href": "https://books.toscrape.com/index.html", "internal": true }],"images": ["https://books.toscrape.com/media/cache/fe/72/fe72f0532301ec28892ae79a629a293c.jpg"],"tables": [{"headers": ["UPC", "a897fe39b1053632"],"rows": [["UPC", "a897fe39b1053632"], ["Product Type", "Books"], ["Price (excl. tax)", "£51.77"], ["Availability", "In stock (22 available)"]]}],"emails": [],"phones": [],"jsonLd": [],"metaTags": { "created": "24th Jun 2016 09:29" },"custom": { "title": "A Light in the Attic | Books to Scrape - Sandbox", "price": "£51.77", "description": "\n It's hard to imagine … " },"extracted": null,"mode": "heuristic","error": null,"scraped_at": "2026-10-26T06:57:22.456Z"}
Pricing: how much does HTML to JSON conversion cost?
You pay one start fee per run and one event per record. Apify platform usage is included.
| Event | FREE | BRONZE | SILVER | GOLD, PLATINUM, DIAMOND |
|---|---|---|---|---|
| Result parsed (primary event) | USD 0.003001 | USD 0.002925 | USD 0.00285 | USD 0.0024 |
| Per 1,000 records | USD 3.00 | USD 2.93 | USD 2.85 | USD 2.40 |
| Actor start, once per run | USD 0.006251 | USD 0.006094 | USD 0.005938 | USD 0.005 |
- Default run, 1 page, FREE tier: USD 0.006251 + USD 0.003001 = about USD 0.0093.
- 100 pages, FREE tier: USD 0.006251 + 100 × USD 0.003001 = about USD 0.31 (about USD 0.25 on GOLD).
Each record is saved first and then charged once. Records whose AI extraction failed are saved with the rule-based result and an error note and are not charged. When the next record would exceed your run's maximum total charge, the run stops cleanly. Model usage in AI mode is billed separately to your own key. Sources that cannot be fetched produce no record and no record charge.
Limits and reliability
- Page URLs are fetched through a fixed datacenter access route (there is no proxy input), with two retries, up to five pages at a time, and a 60-second limit per page. HTML file URLs are downloaded directly, once each, with a 30-second timeout.
- A URL that fails after retries is logged and skipped; it does not appear in the dataset.
- Tables without header cells use their first row as
headersand also keep it inrows. - Text values keep the page's own whitespace, for example the leading line break in
descriptionabove.
FAQ
Do I need an API key to convert HTML to JSON?
No. The rule-based engine needs no key. Only AI mode needs your own AI model API key.
Can it convert HTML tables to JSON?
Yes. It returns up to five tables per page, each with headers and up to 100 rows.
Can I parse HTML that is not on a public website?
Yes. Paste it into htmlContent, or upload .html files and pass their URLs in htmlFileUrls.
Does it work on JavaScript-heavy sites?
Only for content present in the initial HTML. It does not run page scripts or render in a browser.
How many pages can one run handle?
Up to 10,000 records, set with maxResults. One page, pasted block, or file equals one record.
What happens with fields it cannot find?
The field still appears in custom with the value null, so every record keeps the same keys.
Related Actors
- AI Web Scraper — Extract Website Data to Structured JSON: plain-English field extraction with AI included.
- RAG Chunking Crawler — Web Pages to Text Chunks: crawl a site into text chunks for vector search.
- Smart Article Extractor: article body, metadata, and reading time.
- Extract Text from Image URLs — Image OCR Scraper: text from screenshots and scans.
Legal and responsible use
Parse only pages and files you are allowed to access. Follow each site's terms and access rules, and the privacy and data-protection laws that apply to any emails or phone numbers you collect.
Last verified: 2026-10-27