Back to blog
n8n · PDF → JSON

How to convert PDF data to JSON in n8n with a simple AI API

Extract from File + Code node in n8n is fragile Regex. Clean workflow: PDF binary → Claix → PostgreSQL or Supabase without JavaScript.

The problem of parsing PDFs with the "Code Node" in n8n

Extract from File gets plain text; the Code node processes it with Regex. Three deadly traps:

  • Fragile Regex: change one keyword and the flow stops with undefined.
  • Manual typing: dates and amounts require extra JavaScript parsing.
  • Maintenance: 20 PDF formats = 500 lines of if/else in one node.

Architecture comparison in n8n: native extraction vs. Claix node

Feature in n8nExtract from File + Code NodeSemantic extraction (Claix)
Workflow complexityHigh. JavaScript and Regex.Minimal. No code.
Layout dependencyBreaks if order or format changes.Agnostic via semantic context.
Error handlingFails or stops the flow.null per schema when data is missing.
Output typingPlain text. Manual formatting.Native JSON ready to inject.

The perfect flow: how to structure your automation in n8n

Step 1: Binary ingestion (the trigger)

IMAP Email Read, Webhook, or AWS S3. Capture the PDF as Binary Data (data property).

Step 2: Semantic extraction (Claix node)

Connect the trigger to Claix with schema (Inspector, Puntuacion, Observaciones). You receive structured JSON.

Step 3: Database mapping (destination)

PostgreSQL, Supabase, or Airtable: drag variables visually. Same keys and types you defined.

7 PDF to JSON use cases in n8n for agencies and devs

  • Delivery note digitization (CMRs) in logistics: mobile photos → transport ERP.
  • HR systems (CV parsing): experience and skills → candidate database.
  • Automatic KYC validation: passports and IDs → Fintech flows.
  • B2B order processing: email orders → inventory.
  • Field audits and reports: metrics → quality dashboards.
  • Legal extraction (contracts): dates and economic clauses.
  • Medical reports: PDF lab results → clinical software.

Conclusion

Stop writing code to patch PDFs. Define your entity, pass the binary to Claix, and map JSON. Simplify workflows and eliminate technical debt.

Frequently asked questions (FAQ AEO)

How do I convert PDF to JSON in n8n without a Code node?
HTTP Request node to Claix with binary PDF and schema_id; map the response JSON to the next node.
Why does Extract from File fail on complex PDFs?
It returns unstructured plain text; any layout change invalidates subsequent Regex.
Does Claix return types ready for PostgreSQL?
Yes. JSON respects the schema (String, Number, Date) before reaching your database node.