Skip to content

Convert PDF to JSON with the fields you need

ChatYourData turns a document into JSON with named fields such as invoice_number or delivery_date. You choose a ready document type or describe your own fields, and each value comes back with its page, source text and confidence.

Northfield Fasteners Ltd
14 Mill Lane, Leeds LS1 4AB, United Kingdom

Invoice NF-20418

Invoice date: 12 November 2026
Due date: 12 December 2026

Bill to: Example Workshop Inc.
220 Lake Street, Madison, WI 53703, USA

DescriptionQtyUnit priceAmount
Hex bolt M8 x 40, box of 1001218.50222.00
Lock washer M8, box of 500421.0084.00
Freight164.0064.00

Net: 370.00 GBP
VAT 0%: 0.00 GBP
Total due: 370.00 GBP

Foreign invoice

{
  "invoice_number": "NF-20418",
  "issue_date": "2026-11-12",
  "payment_due": "2026-12-12",
  "seller_name": "Northfield Fasteners Ltd",
  "seller_country": "GB",
  "seller_address": "14 Mill Lane, Leeds LS1 4AB, United Kingdom",
  "buyer_name": "Example Workshop Inc.",
  "currency": "GBP",
  "net_amount": 370,
  "vat_amount": 0,
  "gross_amount": 370,
  "vat_rate": "0%",
  "reverse_charge": false,
  "items": [
    {
      "description": "Hex bolt M8 x 40, box of 100",
      "quantity": 12,
      "unit_price": 18.5,
      "net_value": 222
    },
    {
      "description": "Lock washer M8, box of 500",
      "quantity": 4,
      "unit_price": 21,
      "net_value": 84
    },
    {
      "description": "Freight",
      "quantity": 1,
      "unit_price": 64,
      "net_value": 64
    }
  ]
}

A fictional document with the real result from our model. Select a field to see where it was read from. PDF, PNG, JPG or WEBP up to 10 MB, first three pages, five documents without an account. Files you do not move to an account are deleted after 7 days.

Which documents can be converted to JSON

PDF, PNG, JPG, TIFF, BMP, WEBP, DOCX, XLSX, PPTX, HTML, TXT, CSV and Markdown files up to 25 MB are accepted. These document types are ready to use.

DocumentExample fieldsType key
Invoiceinvoice_number, issue_date, seller_name, gross_amount, itemsforeign_invoice
Receiptseller_name, sale_date, gross_amount, payment_methodreceipt
Purchase orderorder_number, buyer_name, delivery_date, itemspurchase_order
Contractparty_1_name, start_date, notice_period, remunerationcontract
CMR consignment notesender_name, consignee_name, goods, total_weight_kgcmr
Certificate of analysisproduct, batch_number, parameters, overall_resultquality_certificate
Any other documentThe fields you list in the requestschema

Why a plain PDF converter is often not enough

A simple converter writes the text of a PDF into a JSON file page by page. Your code still has to work out which of the numbers is the total and which is the tax, and that logic breaks when a supplier changes the layout.

With field extraction the structure is fixed. Your code reads the same key whether the document came from a supplier in Texas or in Hamburg.

How to define your own JSON schema

List the fields in the request, each with a name and a type such as text, date, money, number or list. You can add a description, other names the field may have in documents, and rules, for example that line items must add up to the total.

If you would rather not write a schema, upload a few examples in the app and the wizard proposes the fields for you.

PDF to JSON with your own schema

No setup is needed before the first request. Send the file together with the fields you want and read them from the response.

Request
curl https://api.chatyourdata.pl/v1/extract \
  -H "X-Api-Key: $CYD_KEY" \
  -F [email protected] \
  -F wait=30 \
  -F 'schema={
    "name": "Order",
    "fields": [
      { "name": "number", "type": "text", "required": true },
      { "name": "amount", "type": "money" }
    ]
  }'
Response (shortened)
{
  "data": {
    "status": "done",
    "fields": {
      "number": { "value": "PO-7731", "confidence": 0.95,
                  "page": 1, "source": "order no. po-7731" },
      "amount": { "value": 2480.0, "confidence": 0.95,
                  "page": 2, "source": "total 2,480.00" }
    },
    "issues": []
  }
}

Questions about PDF to JSON

Can I convert a scanned PDF or an image to JSON?

Yes. Scans, PNG, JPG and WEBP images go through the same endpoint as PDFs with text.

Can I get the whole text instead of fields?

Yes. The OCR endpoint returns the document as Markdown, page by page, with tables preserved.

How do I know a value is correct?

Each field has a confidence between 0 and 1, the page number and the text it was found in. We recommend sending fields below 0.7 and documents with reported issues to a person.

Can web pages be converted to JSON too?

Yes. Send the address of a public page with a list of fields. We respect robots.txt, and values that are not on the page are dropped.

Turn your first PDF into JSON

A trial account includes 200 pages over 14 days, with no card required.