Why JSON out of a PDF?
A PDF is built for viewing, not for reading with code. The content is there, but it’s wrapped in a page-description format that’s awkward to work with programmatically. JSON is the opposite: it’s the format code speaks. Every language parses it, every database stores it, and every API passes it around.
So converting a PDF to JSON is really about getting a document into a shape your software can actually use — to load it into a database, feed it to a language model, drive a pipeline, or pull out specific fields. Instead of a page you have to look at, you get structured data you can loop over.
How to convert a PDF to JSON
- Drop your PDF into the box above (or click to choose one).
- It’s parsed in your browser using its text layer — nothing is uploaded.
- Pick the JSON shape you want — Structured, By paragraph, or Words + positions.
- Copy the JSON, or switch to Markdown, Text, or CSV.
No account, no upload, no cost for text-based PDFs.
What the JSON looks like
The default Structured shape gives you pages, each with its text and typed blocks:
{
"pages": [
{
"page": 1,
"text": "Invoice #1042\nBilled to: Acme Co\nTotal: $1,240.00",
"blocks": [
{ "text": "Invoice #1042", "size": 18 },
{ "text": "Billed to: Acme Co", "size": 11 },
{ "text": "Total: $1,240.00", "size": 11 }
]
}
]
}
Each block keeps its font size, which is often enough to tell a heading from body text — useful when you want to rebuild the document’s structure downstream.
Three JSON shapes, one tool
Different jobs want the data in different forms, so the tool gives you three:
- Structured — pages → text blocks with font sizes. The good default for reading a document back and re-rendering it.
- By paragraph — lines merged into reading-order paragraphs. The best starting point for chunking into an LLM or a vector store, because a paragraph is a natural unit of meaning.
- Words + positions — every word with its
x,y, and width. Use this when position matters: highlighting, redaction, drawing overlays, or layout-aware parsing where you need to know where on the page something sits.
Tick Include PDF metadata to add the document’s title, author, subject, and creation dates to the output.
PDF to JSON for LLMs and pipelines
A lot of PDF-to-JSON traffic these days is people preparing documents for AI. If that’s you, the By paragraph shape is usually the one you want: it gives you clean, reading-order text blocks you can turn straight into chunks and embeddings, without a wall-of-text dump or the noise of per-character positions.
If you’re building something more structured — pulling named fields out of invoices, extracting a table of line items, matching a schema — that’s where the API’s extraction earns its place, because it can run OCR on scans and detect real tables. But for “get this document into clean JSON I can chunk,” the browser tool covers a surprising amount of ground on its own.
Do it in code
The browser tool is for one-off conversions. To do it in your app — in bulk, on scanned files, or with table extraction — call the API.
curl -X POST https://api.pdftojson.dev/v1/extract \
-H "Authorization: Bearer $KEY" \
-F file=@document.pdf -F format=json
import requests
data = requests.post(
"https://api.pdftojson.dev/v1/extract",
headers={"Authorization": f"Bearer {KEY}"},
files={"file": open("document.pdf", "rb")},
data={"format": "json"},
).json()
const form = new FormData();
form.append("file", fs.createReadStream("document.pdf"));
form.append("format", "json");
const data = await fetch("https://api.pdftojson.dev/v1/extract", {
method: "POST",
headers: { Authorization: `Bearer ${KEY}` },
body: form,
}).then((r) => r.json());
Same output as the browser tool, plus OCR for scans and table extraction — and it’s batch-ready.
Digital vs scanned PDFs
This distinction explains most “why didn’t it work?” moments, so it’s worth knowing.
A digital PDF was created by software and carries a real text layer — the tool reads it directly, in your browser, for free. A scanned PDF is just images of pages; there’s no text underneath, so there’s nothing to extract until something has read the image. The tool detects that case and points you to the API, which runs OCR plus a vision model to pull the text out anyway. A quick check: if you can select and copy text in a normal PDF viewer, it’s digital; if you can’t, it’s a scan.
The cases that need cleanup
Most everyday PDFs convert cleanly. A few don’t, and it’s usually one of these:
- Scanned pages — no text layer, so they need OCR (the API).
- Complex tables — a table is stored as positioned text, not a grid, so recovering columns needs real table detection (the API).
- Multi-column layouts — reading order can jump between columns and need a little cleanup.
- Tightly-kerned text — some PDFs position each character separately; the parser reconstructs words from the gaps so they don’t come out as
S t e p p i n g.
PDF to JSON vs other tools
- pypdf / PyMuPDF / pdfplumber — capable Python libraries if you’re already writing code and happy to maintain the extraction logic yourself. This is the zero-setup version of the same thing, with an API when you outgrow the browser.
- Pasting into a chatbot — fine for a one-off, but not a repeatable conversion, and it means sending the file to a third party.
- Unstructured and similar frameworks — powerful document-processing pipelines, but heavier than you need if you just want clean JSON out of a PDF.
Is PDF to JSON private?
Text-based PDFs never leave your device — parsing happens entirely in your browser, so there’s nothing to upload, store, or delete. OCR and table extraction run on the API, where files are processed by the service under its current data-retention policy.