Text to JSON: Extract Structured Data from Any Document
Pricing
$2.00 / 1,000 document processeds
Text to JSON: Extract Structured Data from Any Document
Turn messy text, emails, HTML, PDFs and Word docs into clean JSON that matches your own schema. Invoices, receipts, forms, listings and emails. Free rule-based extraction, or bring your own LLM key. Built for AI agents and MCP.
Pricing
$2.00 / 1,000 document processeds
Rating
0.0
(0)
Developer
Birchwood Data
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
16 days ago
Last modified
Categories
Share
What is Text to JSON?
Turn messy text into clean JSON that matches your own schema. Paste an email, an invoice, a receipt, a web page or a form, or point it at PDF / Word / HTML links. Describe the fields you want, and you get back validated JSON in exactly that shape.
Use it as a text to JSON converter, PDF data extractor, invoice and receipt parser, email parser or document parsing API. Run it in Apify Console with no code, call it from the API or Python/JavaScript clients, schedule it, or plug it into Make, Zapier, n8n and AI agents over MCP.
You pay $2.00 per 1,000 documents ($0.002 each). Documents that fail, or where none of your fields are found, are free. There's no monthly rental, no platform-usage charge and no AI markup.
Why use Text to JSON?
- Your schema, your shape. Use a standard JSON Schema or a one-line shorthand like
{"name": "string", "total": "number", "items": [{"sku": "string", "qty": "integer"}]}. Nested objects, enums and arrays of objects (tables and line items) all work. - Free extraction engine by default. The built-in rule-based extractor reads labels (
Invoice #: 42), tables (pipe, tab, space-aligned, CSV and HTML), bullet lists and common patterns (emails, phones, URLs, dates, money, addresses). It's deterministic, fast, and costs no AI tokens. - Bring your own LLM key for free-form text. Add your own OpenAI, Anthropic, Gemini, OpenRouter, Groq, Mistral, DeepSeek or any OpenAI-compatible key and the Actor uses that model. Your provider bills you directly and we add nothing. The key is a secret input: Apify stores it encrypted, and it's never logged or written to the output. Gemini's free tier works too.
- Validated output. Every result is checked against your schema, so you get
valid,validationErrors,missingRequired,missingFieldsand acompletenessscore. Your pipeline can tell a complete record from a partial one. - Clean types.
"$1,299.00"becomes1299,"Sept 28, 2026"becomes"2026-09-28","yes"becomestrue, and"€1.299,00"becomes1299. - Many formats. Accepts pasted text, HTML, PDF (with a text layer), DOCX, JSON, CSV and TXT, up to 25 MB per file.
- Built for AI agents. It works as a tool over the Apify MCP server in Claude, Cursor, VS Code, n8n and Make. Prices are per event only, so the Actor also qualifies for agentic payments.
What can you use Text to JSON for?
- 🧾 Invoices and receipts: vendor, invoice number, dates, totals, tax and line items.
- 📧 Emails and contact forms to CRM: name, company, email, phone, budget and intent.
- 🏠 Listings and product pages: price, specs, features and availability.
- 📄 Forms and applications: applicant details, addresses, yes/no answers and skills.
- 💼 Job posts and resumes: title, salary, location and requirements.
- 🤖 AI agent pipelines: a dependable "text to JSON" step for n8n, Make, Zapier, LangChain or your own agent.
How to extract structured data from text, PDFs and documents
- Paste your document into Text, or add Document URLs, or send a batch in Multiple texts.
- Describe the output in Output schema. The shorthand is the quickest way to start.
- Optional: choose an LLM provider and paste your own API key to use AI extraction.
- Click Start. Each document comes back as one dataset item, and the
OUTPUTrecord holds just the extracted JSON.
Schema shorthand
| Shorthand | Meaning |
|---|---|
"string", "number", "integer", "boolean" | basic types |
"date", "datetime" | ISO 8601 date or date-time |
"email", "url", "phone" | pulled out and cleaned |
"open|closed|pending" | enum (one of these values) |
["string"] | list of strings |
[{"sku": "string", "qty": "integer"}] | table / line items |
{"street": "string", "city": "string"} | nested object |
You can also pass any standard JSON Schema (draft-07 / 2020-12, with local $refs). Add a title to a property to tell the extractor which label to look for, e.g. "customer": {"type": "string", "title": "Bill to"}.
Input example
{"text": "ACME Supplies Inc.\nInvoice #: INV-2026-0042\nInvoice Date: Sept 28, 2026\n\nDescription Qty Unit Price Amount\nSteel brackets 4 $12.50 $50.00\nHex bolts M8 200 $0.15 $30.00\n\nTotal Due: $80.00","schema": {"vendor_name": "string","invoice_number": "string","invoice_date": "date","total": "number","line_items": [{ "description": "string", "quantity": "number", "unit_price": "number", "amount": "number" }]}}
Output example
{"documentId": "text","status": "ok","method": "rules","data": {"vendor_name": "ACME Supplies Inc.","invoice_number": "INV-2026-0042","invoice_date": "2026-09-28","total": 80.0,"line_items": [{ "description": "Steel brackets", "quantity": 4, "unit_price": 12.5, "amount": 50.0 },{ "description": "Hex bolts M8", "quantity": 200, "unit_price": 0.15, "amount": 30.0 }]},"valid": true,"validationErrors": [],"missingRequired": [],"missingFields": [],"fieldsFilled": 5,"fieldsTotal": 5,"completeness": 1.0,"charsProcessed": 214,"truncated": false,"llmError": null,"processedAt": "2026-10-04T20:09:02Z"}
Rules engine or LLM: which should I use?
| Rule-based (default, free) | Your LLM key | |
|---|---|---|
| Best for | Semi-structured docs: invoices, receipts, forms, "Label: value" text, tables, spec sheets, listings | Free-form prose, unusual layouts, inferring meaning |
| Cost | $0.002 per document | $0.002 per document + your provider's token cost |
| Speed | Milliseconds | Seconds |
| Deterministic | Yes | Mostly (temperature 0) |
If an LLM call fails (bad key, quota, timeout), the Actor falls back to the rules engine and reports the reason in llmError. You can turn this off with Fall back to rule-based extraction.
How much does it cost to convert text to JSON?
Pay per event: $0.002 per document processed ($2.00 per 1,000).
- One charge per document that comes back with
status: "ok"(at least one field extracted). - Failed documents (bad URL, unreadable file) and empty results (
status: "empty", none of your fields found) are free. - No usage pass-through: platform compute is included.
- Set Maximum cost per run in the run options to cap spending. The Actor stops cleanly when it reaches the cap.
Use it from AI agents (MCP)
Add the Actor as a tool to any MCP client through Apify's hosted MCP server:
https://mcp.apify.com/?tools=birchwood-data/text-to-data
Your agent passes text (or urls) and a schema, and gets the JSON back. Parameter descriptions are written so agents can fill them in without help.
API
curl -X POST "https://api.apify.com/v2/acts/birchwood-data~text-to-data/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \-H "Content-Type: application/json" \-d '{"text": "Name: Ana Diaz\nEmail: ana@example.com", "schema": {"name": "string", "email": "email"}}'
FAQ
Do I need an OpenAI or other LLM API key?
No. The default rule-based engine is free of AI costs and works well on invoices, receipts, forms, tables and "Label: value" text. Add your own key only for free-form prose.
Can it extract tables and invoice line items?
Yes. Define an array of objects in your schema (for example [{"sku": "string", "qty": "integer"}]) and pipe, tab, space-aligned, CSV and HTML tables are mapped to it row by row.
Which file formats can I parse?
Pasted text, HTML, PDF with a text layer, DOCX, JSON, CSV and TXT, up to 25 MB per file. Scanned image-only PDFs need OCR first.
Can I process many documents at once?
Yes. Use Multiple texts or Document URLs to send a batch. Each document becomes one dataset item that you can export as JSON, CSV or Excel.
How do I call it from my code or an AI agent?
Use the API example above or the Apify Python/JavaScript client. For AI agents, add it as a tool via the Apify MCP server.
Limitations
- Scanned, image-only PDFs need OCR first. We read the PDF's text layer.
- The rules engine looks for labels, tables and patterns. It does not interpret free prose the way an LLM does, so use your own key for that.
- Fields that aren't found are returned as
null(or[]for lists). They're never guessed. - Pages that need a login or JavaScript to render aren't fetched. Paste their text instead.
Privacy
Documents are processed only during your run and stored only in your own run's dataset. Your LLM key is a secret input and is never logged or saved to the output. When you use an LLM, the text goes to the provider you chose, under your own account with them.
Other Actors by Birchwood Data
| Actor | What it does |
|---|---|
| ATS Job Scraper: Greenhouse, Lever, Ashby & More | Scrape live jobs from Greenhouse, Lever, Ashby, SmartRecruiters and Recruitee career pages, with salary, location and remote flag. Feed the job descriptions into Text to JSON to extract skills or requirements. |
Support
Found a document it handles badly? Open an issue on the Issues tab with a (redacted) sample and the schema you used. We usually improve the extractor within a few days.