All articles
AI Development6 min read20 June 2026

PDF to Structured JSON: A Practical Guide for AI Developers

Schema-based extraction gives you predictable JSON from any document. Here is how to design schemas, handle confidence scores, and build production-ready pipelines.

PA

ParseAI Editorial Team

Document automation research and analysis

Most AI development workflows eventually hit the same wall: you need data that is locked inside a PDF. The document might be an invoice, a bank statement, a contract, a lab report, or a government form. You need specific values out of it as JSON. Here is the most reliable way to do that.

Two Approaches to PDF to JSON

There are two dominant patterns in production:

Pattern 1: Parse then prompt. Convert the document to text with a parsing tool, pass the text to an LLM with a prompt asking it to extract specific fields, parse the LLM's output as JSON. This works for prototypes but is brittle in production: LLM output format varies, hallucination risk on numeric values is real, and you are paying LLM inference costs on full document text for every extraction.

Pattern 2: Schema-based extraction API. Submit the document and a schema to an extraction API. The API returns structured JSON with one value per field, plus a confidence score for each. This is deterministic, auditable, and purpose-built for document data extraction. This is what the ParseAI Extract API does.

For any repeated document type in a production pipeline, Pattern 2 is more reliable. You define the schema once. Every subsequent document of that type is processed the same way.

Designing Your Extraction Schema

ParseAI Extract schemas are defined in plain English. Each field has a name and a plain-language description of what to look for. You do not write regex, you do not specify coordinates, you do not define templates.

For a salary slip, the schema might look like:

  • employee_name: Full name of the employee as it appears on the slip
  • gross_salary: Total gross salary amount for the month before deductions
  • net_salary: Take-home salary after all deductions
  • employer_name: Name of the organisation issuing the salary slip
  • pay_month: The month and year this salary slip covers

Descriptions that are specific extract more accurately than descriptions that are vague. "Total gross salary before deductions" is better than "salary amount" because salary slips contain multiple salary-related numbers.

Understanding the JSON Response

The Extract API returns a JSON object with each field name mapped to an object containing the extracted value and a confidence score:

{
  "employee_name":  { "value": "Ananya Krishnan",  "confidence": 0.97 },
  "gross_salary":   { "value": "₹82,000",          "confidence": 0.95 },
  "net_salary":     { "value": "₹71,340",          "confidence": 0.94 },
  "employer_name":  { "value": "Infosys Limited",  "confidence": 0.96 },
  "pay_month":      { "value": "May 2026",          "confidence": 0.92 }
}

Each field is independently scored. A field that is clearly printed and unambiguous scores close to 1.0. A field that is handwritten, partially obscured, or ambiguous between multiple values scores lower.

Using Confidence Scores in Production

Confidence scores are the mechanism that makes automated document processing reliable at scale. The basic production pattern:

  • High confidence (above 0.85): Accept the value and process automatically. No human review required.
  • Medium confidence (0.70 to 0.85): Route to a human review queue. Surface the field and the document region for quick confirmation.
  • Low confidence (below 0.70): Flag as extraction uncertain. Either escalate for full document review or request the document be resubmitted in better quality.

Your thresholds will depend on the document type and the downstream consequences of an incorrect value. For fields that feed into financial calculations or legal records, tighter thresholds make sense. For fields used for internal categorisation, looser thresholds may be acceptable.

Handling Edge Cases

A few patterns that come up repeatedly in production:

Missing fields

If a field defined in your schema does not appear in the document, the API returns a null value with a confidence score of 0. This is not an error — it is an explicit signal that the field was not found. Handle it explicitly in your pipeline rather than letting it propagate silently.

Multi-value fields

When a field might appear multiple times (line items in an invoice, multiple transactions on a statement), define the field with a description that makes clear you want all instances. The API returns an array of values for list-type fields.

Currency and number formatting

Indian documents use both lakh notation (₹1,24,500) and crore notation. The Extract API returns values as they appear in the document. Your pipeline should normalise numeric formats after extraction if you need a consistent numeric type.

Zero data retention: documents submitted to the Extract API are processed in memory only. Nothing is stored. Each API call is stateless. This applies regardless of document type or content.

See ParseAI on your documents

Send us 10 documents from your workflow. We'll show you the extraction output in 24 hours.

Book a demo