# Convert a PDF invoice to JSON

For the case where the next step is code. The invoice comes out with the same key names every other format here produces, so nothing downstream has to know it started as a PDF.

Source: https://tally-stick.com/pdf-to-json

## The same keys, whatever the PDF was

A PDF invoice can be three quite different documents: one with the e-invoice XML attached, one with a text layer, and one that is only an image. All three are read into the same model here, so the JSON has the same shape either way and your code does not branch on it. The payload does say which reading produced it, because a field recognised from a scan deserves a different amount of trust than one lifted out of attached XML.

## What you get out

- document, seller, buyer, lines, tax, totals and payment as objects
- The same key names across every input format the tool reads
- Numbers as numbers, dates in ISO form
- The detected format and the reading it came from, in the payload

## Questions

### Is there an API?

Not yet. This page is a browser tool: the JSON is produced on your machine and downloaded. An API endpoint is on the paid roadmap, so say so on the feedback form if that is what you need.

### How reliable is the JSON from a scan?

As reliable as the scan. Recognised text is marked as such in the payload, and the totals check runs on it the same way, so a document whose lines do not add up is visible rather than silent.

### Can it read a PDF that is not an invoice?

It will refuse rather than invent. A page with nothing invoice-shaped on it is reported as unread, not returned as an empty invoice.

## Related

- [PDF invoice to Excel](https://tally-stick.com/pdf-to-excel)
- [UBL to JSON](https://tally-stick.com/ubl-to-json)
- [PDF invoice to CSV](https://tally-stick.com/pdf-to-csv)

## How it works

The invoice is read on your own device. No file is uploaded, no account is required, and the fair usage limit is the only cap. Exports are PDF, Excel, CSV and JSON.
