Skip to main content
PDFBase

PDF to JSON Converter

Local

Extract PDF page text as structured JSON data

All Tools
PDF to JSON
Local
Tool Details
Input formatsPDF
Output formatJSON
Max file size50 MB
Max files1
ProcessingLocal

Privacy First

Your files are processed entirely in your browser. Nothing is uploaded to any server.

How do I convert a PDF into JSON?

Select the PDF and run the converter to download a .json file. The output is a single object with a pages array; each entry holds a one-based pageNumber and the text extracted from that page, pretty-printed with two-space indentation. Coordinates, fonts, and document metadata are not included. Parsing happens locally in your browser.

About the PDF to JSON Converter

Extract the embedded text layer from each PDF page into a JSON pages array. Each entry contains the one-based page number and extracted text; metadata and text coordinates are not included.

  • Get a pages array of page number and text that a script, spreadsheet or ETL job can iterate without a PDF library.
  • Build a quick corpus for search indexing or embedding generation without paying per page for a document-parsing API.
  • Diff two versions of a report programmatically by comparing the extracted text of each page instead of eyeballing the rendered output.

How to use the PDF to JSON tool

  1. 1

    Upload PDF file

    Select PDF file from your device or drag file into the upload area.

  2. 2

    Review files

    Review the selected files and continue when they are ready.

  3. 3

    Convert to JSON

    Run the PDF to JSON tool to create the JSON output.

  4. 4

    Download the result

    Download the finished file. The original file stays on your device and is not uploaded.

What exactly does the JSON output look like?

A deliberately small, predictable shape: one top-level object with a single pages key holding an array, where every element has pageNumber and text. Nothing else. That means you can consume it with two lines of code and no schema documentation, and it stays stable regardless of how complicated the source document is. What it also means is that there is no bounding-box data, no font information, and no metadata block — if your pipeline needs geometry, this is not the right tool.

Why pick JSON over plain text extraction?

Because page boundaries survive as structure rather than as a convention. With plain text you have to agree on a separator and then split on it; with JSON the pages arrive as an array you can index, filter, or map straight into per-page database rows, embeddings, or search documents. It is the better choice whenever the consumer is code rather than a person, and especially when you need to cite which page a passage came from.

What happens with a scanned or image-only PDF?

You get the correct structure with empty text. The converter reads the PDF’s embedded text layer, and a scanned document has none — the page is a picture. The pages array will still list every page with its number, so the shape of the response is unchanged, but the text values will be blank. There is no OCR step anywhere in this product, so an image-only PDF has to be run through OCR elsewhere before extraction can find anything.

Are my files uploaded when converting PDF to JSON?

No, and that is usually the deciding factor for this particular conversion. Turning documents into JSON is a developer task, and the normal alternative is posting the file to an extraction API — which puts customer contracts or regulated records on someone else’s infrastructure and inside their logs. Here the parse runs in your browser and the JSON is generated in memory, so the document never leaves the machine you are working on.

Extract PDF text as JSON in code

This page returns a pages array of page number and text. Below is the same structure produced from a script, in the two runtimes people usually automate it in.

Node.js (pdfjs-dist)

The same library this page runs, used headlessly.

// npm install pdfjs-dist
import { getDocument } from "pdfjs-dist/legacy/build/pdf.mjs"
import { readFile } from "node:fs/promises"

const data = new Uint8Array(await readFile("report.pdf"))
const pdf = await getDocument({ data }).promise

const pages = []
for (let n = 1; n <= pdf.numPages; n++) {
  const content = await (await pdf.getPage(n)).getTextContent()
  const text = content.items.map((item) => item.str).join(" ")
  pages.push({ pageNumber: n, text })
}

console.log(JSON.stringify({ pages }, null, 2))

Python (PyMuPDF)

Fast, and it can also give you per-block coordinates this page does not expose.

# pip install pymupdf
import json, pymupdf

doc = pymupdf.open("report.pdf")
pages = [
    {"pageNumber": index + 1, "text": page.get_text()}
    for index, page in enumerate(doc)
]

print(json.dumps({"pages": pages}, indent=2))

Shell (poppler + jq)

No runtime needed if poppler-utils is already installed.

pdftotext -layout report.pdf - \
  | jq -R -s "{ text: . }"

How to do this offline, on the command line

For structured extraction, the useful command-line tools give you text plus geometry.

pdftotext

macOS: brew install poppler · Debian/Ubuntu: apt install poppler-utils

pdftotext -bbox-layout report.pdf report.xml

Emits every word with its bounding box as XML — more structure than this page returns, if you need coordinates.

mutool

macOS: brew install mupdf-tools · Debian/Ubuntu: apt install mupdf-tools

mutool draw -F stext -o report.xml report.pdf

Structured text output with block, line and character positions.

Frequently Asked Questions

What structure does the JSON output have?
The output is an object with a pages array. Each entry contains a one-based pageNumber and the extracted text for that page. Document metadata, page dimensions, font data, and text coordinates are not included.
What is PDF to JSON useful for?
It turns page text into a simple machine-readable structure for scripts, search indexing, data pipelines, or text analysis. It does not preserve layout or support position-based field extraction.
Does it extract text from scanned PDFs?
No. It reads the PDF’s embedded text layer. Scanned pages are images and would need OCR, which this tool does not perform.
Can I automate this conversion?
The web tool is manual by design — everything runs in your browser for privacy. For automation, the same extraction is available programmatically via the open-source pdf.js library that powers this tool.

Need More Tools?

Explore our collection of 58 free PDF tools, all with privacy-first processing.

Browse All Tools