One call, structured JSON out

PDF to JSON API: Convert Any PDF to Structured JSON

POST a native or scanned PDF and read structured JSON back: named fields, table rows and a confidence score on every value, from a single API call. Scans are run through OCR on the same endpoint, so one code path handles digital and scanned PDFs alike.

No layout-to-JSON mapping to write, no OCR engine to host. Drop a PDF in below and see the JSON your code would receive. Last updated July 2026.

  • Named fields, not loose text
  • Tables as ordered rows
  • Confidence score per value
  • Reads scans, not just digital PDFs
Try it now, no signup

PDF, JPG, PNG, BMP, HEIC, TIFF

Upload a document to extract

See the JSON your PDF converts to, right in the browser.

SOC 2 Type II
256-bit encryption
US data handling
REST and JSON
3 calls
upload, extract, get JSON
1 endpoint
native and scanned PDFs alike
Fields + tables
named, not loose text
Confidence
a score on every value
// The short answer

How to convert a PDF to JSON

To convert a PDF to JSON, send the file to a document extraction API and read the JSON it returns. The reason a PDF needs converting at all is that its layout locks the data to page positions rather than to a machine-readable structure, so software cannot query it. An API reads the page, recovers the values, and returns them as JSON: named fields, table rows with cells in order, and a confidence score on each value. If the PDF is a digital export it reads the embedded text; if it is a scan it runs OCR on the image first. Because the response is JSON, your code deserializes it straight into an object and writes it to a database, a queue, or an accounting workflow. For a single digital PDF you can instead parse text locally with an open-source library, but you then write the layout-to-JSON mapping yourself, and libraries cannot read a scan at all.

The three calls

  • Upload: POST the PDF, get a file_id.
  • Extract: POST the file_id, get a job hash.
  • Get: poll or webhook for the JSON.
// Copy and run

Convert a PDF to JSON with the API

Three calls, from a PDF on disk to structured JSON. This is Python with the requests library; the same three calls work from any language. Swap in your API key from the dashboard.

pdf_to_json.py
import requests, time, json

API_KEY = "YOUR_API_KEY"
BASE = "https://docuocr.com/api/documents"
headers = {"Authorization": f"Bearer {API_KEY}"}

# 1. Upload the PDF (native or scanned), get a file_id
with open("invoice.pdf", "rb") as f:
    up = requests.post(f"{BASE}/upload", headers=headers, files={"file": f})
file_id = up.json()["file_id"]

# 2. Start extraction, get a job hash
ex = requests.post(f"{BASE}/extract", headers=headers, json={"file_id": file_id})
job = ex.json()["extraction_hash"]

# 3. Poll until the JSON is ready
while True:
    res = requests.get(f"{BASE}/extraction/{job}", headers=headers).json()
    if res["status"] == "completed":
        break
    time.sleep(2)

# res["fields"] and res["tables"] are structured JSON, ready to store
print(json.dumps(res["fields"], indent=2))

That is the whole conversion. For a production batch, wrap each call in retry logic with exponential backoff on HTTP 429, and register a webhook instead of the polling loop so each result arrives as its document finishes. The document OCR API reference covers the full request and JSON response shape, and the Python OCR API guide expands this example.

// PDF to JSON, compared

Every way to turn a PDF into JSON

What you get back differs far more than the price does. The real question is how much of the layout-to-JSON mapping the tool does for you, and whether it can read a scan. Verified July 2026.

Tool What the JSON contains Reads scans (OCR) Best for
DocuOCR API Named fields, table rows and confidence as JSON Yes, one endpoint Structured JSON from real business PDFs, scans included
Google Document AI Text plus entities as JSON, needs a processor Yes Google-native pipelines with a defined schema
AWS Textract A Blocks array (geometry and relationships) Yes AWS teams that will assemble fields from blocks
Azure AI Document Intelligence Layout and prebuilt-model fields as JSON Yes Azure stack, prebuilt invoice or receipt models
Google Cloud Vision Text and bounding boxes, no named fields Yes Raw text off an image, mapping done by you
Mistral Document AI Markdown plus structured JSON output Yes LLM parsing of mixed narrative and data
pdfplumber / PyMuPDF (open source) Text and positions, you build the JSON No (digital PDFs only) A one-off digital PDF with a clean text layer

The honest split: an open-source library is the right call for a single digital PDF with a clean text layer, and the cloud SDKs fit teams already standardized on that cloud. But a scan is an image that libraries cannot read, and raw OCR APIs return text you still have to map into fields. DocuOCR returns named fields, tables and confidence already structured, so the mapping code disappears. See the OCR API pricing comparison for per-1,000-page rates, and PDF table extraction if you only need the tables.

// How it works

From a PDF to a JSON object in four steps

1. Authenticate

Generate a key in the dashboard and send it as a Bearer token on every request.

2. Upload the PDF

POST a native or scanned PDF as multipart form data and read the file_id from the JSON.

3. Extract

POST the file_id to start an async job. Scans are OCR-ed here; digital PDFs are read directly.

4. Read the JSON

Poll or receive a webhook, then deserialize fields, table rows and confidence into your model.

// Where teams use it

What developers build on PDF to JSON

Accounts payable

Turn PDF invoices into JSON line items and post them to an ERP, QuickBooks or NetSuite with no manual entry.

Data pipelines

Convert PDFs to JSON at the ingest stage so every downstream service receives typed, queryable records.

AI and RAG inputs

Structure PDFs into clean JSON before indexing, so retrieval and LLM answers work from fields, not raw dumps.

Reporting from statements

Read scanned statements and reports into JSON table rows, then load them into a warehouse for analytics.

KYC and onboarding

Extract IDs and forms to JSON, check confidence scores, and route low-confidence values to a reviewer.

System integration

Feed the JSON straight into APIs and databases so document data flows between apps without a human retyping it.

// Frequently asked

PDF to JSON FAQ

How do I convert a PDF to JSON?
Send the PDF to a document extraction API and read the JSON it returns. With DocuOCR that is three HTTPS calls: POST the file to get a file_id, POST the file_id to start extraction, then GET the result as JSON with named fields, table rows and a confidence score on each value. If the PDF is a scan, the same endpoint runs OCR on the page image, so you get JSON either way. For a purely digital PDF you can also parse text locally with a library like pdfplumber, but you then write the JSON structure yourself.
What is the best way to turn a PDF into JSON?
It depends on the PDF. For a one-off digital PDF with a clean text layer, an open-source library (pdfplumber, PyMuPDF, pdf.js) reads the text for free, though you map it into JSON by hand. For scanned PDFs, mixed layouts, or volume, a hosted API is the reliable path because it runs OCR and returns named fields instead of loose text. DocuOCR returns the fields, tables and confidence already structured, so most of the mapping code you would otherwise maintain is gone.
Can I get JSON from a scanned PDF?
Yes. A scanned PDF is an image, so it needs OCR before there is any text to structure. Open-source PDF libraries do not OCR, so they return nothing useful from a scan. A document OCR API reads the page image and returns the recognized text as structured JSON. DocuOCR treats native and scanned PDFs through the same endpoint and returns the same JSON shape, so your code does not branch on how the PDF was produced.
What does the PDF to JSON API return?
A JSON object your code deserializes directly. DocuOCR returns named fields (invoice number, date, totals), table rows with cells in order, and a confidence score on every value so you can flag anything below a threshold for review. Raw OCR APIs like Google Cloud Vision return text and bounding boxes but not named fields, and AWS Textract returns a Blocks array you assemble into fields yourself. The difference is how much mapping code you write after the response.
Is PDF to JSON conversion accurate?
On clean digital PDFs the text is read exactly, because there is a real text layer. On scans, accuracy depends on the OCR quality and the scan itself, and typically runs in the high 90s on clear documents. What separates production systems is the confidence score returned on each field: it lets you auto-accept high-confidence values and route low-confidence ones to a human, rather than trusting every value blindly. DocuOCR returns that score per value.
How do I convert a PDF to JSON in Python?
For a digital PDF, pdfplumber or PyMuPDF read the text and you build the JSON structure in your own code. For scans or structured fields, call an API from Python with the requests library: post the PDF, start extraction, and json.loads the response into a dict. The API path is the same three calls in any language. See the Python OCR API guide for runnable code that posts a PDF and reads the JSON back.
Do I need OCR to convert a PDF to JSON?
Only if the PDF is a scan or a photo. A digital PDF exported from software has a real text layer, so a parser reads the characters directly with no OCR. A scanned PDF is a picture of a page, so the words only exist as pixels and OCR is required to recover them. Because you often cannot tell which kind a file is up front, an API that handles both through one endpoint saves you from detecting and branching in your own code.
How much does a PDF to JSON API cost?
You pay per page or per document, not per field. Raw text OCR runs about $1.50 per 1,000 pages at Azure, AWS and Google, Mistral is $4 per 1,000, and structured extraction that returns named fields runs higher. DocuOCR bills per page on a plan, roughly $14 to $20 per 1,000 pages, with fields, tables and confidence included in that rate. A free tier lets you test the JSON output on your own PDFs before you pay.

Convert your first PDF to JSON today

Generate an API key, paste the three calls above, and read structured JSON back in minutes. No OCR engine to host, no mapping code to maintain, and a free tier to test the output on your own PDFs before you pay per page.