Convert PDF to JSON
JSON is the output for a pipeline rather than a reader. Every line comes back with its text, its type, where it sat on the page and how confident the model was.
- One entry per line, with a bounding box and a confidence score
- Line types: text, math, table cell, code, pseudocode, caption
- Page-level structure, not a flat string
- The same request can also return Markdown or DOCX
What line data gives you that Markdown does not
Markdown is the output for a person. JSON is the output for code that has to make decisions about each part of the page.
Structure you can branch on
A line carries a type as well as text, so a pipeline can treat an equation differently from a caption without guessing from the characters.
Geometry, for checking and for cropping
Every line has a box on the page. That is what lets you highlight a source region in a viewer, or crop a figure out of the original.
Confidence, so you can route the doubtful cases
A per-line score means a pipeline can send the bottom few percent to review rather than accepting everything equally.
What the line data contains
Per-line boxes and confidence scores
include_line_data on v3/pdf returns them for every line. Per-word data is a v3/text option and is not available for PDF requests.
Table cells tagged with their spans
A table_cell line type carries spanning and split subtypes, so merged cells and multi-row headers are recoverable from the JSON.
Algorithms and pseudocode as their own types
code and pseudocode are line types, and algorithm and pseudocode are diagram subtypes, so a listing is identifiable rather than inferred.
How to convert PDF to JSON
Upload your PDF
Drag it into the Mathpix Snip web editor, or pick it from your files.
Convert it to JSON
Recognition runs on the whole document: math, tables, figures and layout together.
Export or copy the JSON
Download the JSON, or copy it straight to the clipboard and paste it where you need it.
What Mathpix accepts, and the limits that apply
Which files you can send
PDF, EPUB, Word (DOCX, DOC), PowerPoint (PPTX), OpenDocument Text (ODT), DjVu, WordPerfect (WPD), Mobipocket (MOBI) and Amazon Kindle (AZW3)
What you get back
Line-by-line JSON with per-line geometry, types and confidence, alongside Mathpix Markdown and any of the document formats from the same request.
The size limits that apply
One PDF, uploaded: 1 GB
Files API, per file: 15 GB
Files API, files per job: 200,000
Converting PDF to JSON: common questions
What is in the JSON?
One entry per recognised line: its text, its line type, a bounding box on the page and a confidence score. Table cells additionally carry their row and column spans.
Do I get per-word data too?
Not for PDFs. include_word_data is a v3/text option, so word-level output is available when you post an image rather than a document.
Can I get JSON and DOCX from one upload?
Yes. Recognition happens once and the formats are chosen at download time, so asking for both costs one conversion rather than two.
What is the confidence score for?
Routing. It lets a pipeline send its least certain lines to a human instead of treating every line as equally reliable.
Other formats you can convert PDF to
Keep the reading order on journal pages
Layout recognition, and how to verify it.
Extract the data rather than the document
The wider extraction workflow.
Every output format from one upload
The hub for document conversion.