How to transform csv to json

Describe the problem/error/question

I want to output a json structure with 1 item per line of csv structure looking like this which is returned by a webservice (https://n8ntest-pa.free.beeceptor.com/orders) in a json data element.

“geänd durch”;“ÄndDatum”;“ÄndZeit”;“Firma”;“BA”;“RefNr”;“EDI-ReferenzNr”;“Nachr.-typ”;“ausgeben”;“Inhouseverzeichnis”;“Inhousedatei”;“LfdNr”;“Original Inhalt”;“Geänderte Inhalt”;“Inhalt Beschreibung”;“Meldung”;“angel durch”;“AnlDatum”;“AnlZt”;“Kunde”;“Sachbearb”;“BelegNr”;“Belegdatum”
“batch”;13.03.2014;“09:41:07”;“1011”;“U”;0;3779324;“ORDERS”;nein;“”;“/appl/psag/spool/edifact/ediin/ORDERS30”;1;“1000000000000ANNA SCHMIDT 20140313”;“”;“1|1”;“- -00000”;“batch”;13.03.2014;“09:41:07”;111260;“Hallermann”;0;13.03.2014
“”;;“”;“1011”;“U”;0;3779324;“ORDERS”;nein;“”;“/appl/psag/spool/edifact/ediin/ORDERS30”;2;“3000000000000”;“”;“3|1”;“- -00000”;“batch”;13.03.2014;“09:41:07”;0;“”;0;13.03.2014
“”;;“”;“1011”;“U”;0;3779324;“ORDERS”;nein;“”;“/appl/psag/spool/edifact/ediin/ORDERS30”;3;“500000000000000001000001000 00000000000000000000”;“”;“5|2”;“- -00000”;“batch”;13.03.2014;“09:41:07”;0;“”;0;13.03.2014

To do that I would not like to code but use existing nodes. Background: We are evaluating n8n for the use of customers who shouldn’t be writing js for such tasks as this.

Therefore I convert this to binary first and then want to get the structure with “extract from file” node.

What is the error message (if any)?

No error but the extract node again only outputs a single data node.

Please share your workflow

Share the output returned by the last node

That’s the result at the moment

Should be this

Information on your n8n setup

  • Debug info

    core

    • n8nVersion: 1.110.1
    • platform: docker (cloud)
    • nodeJsVersion: 22.19.0
    • database: sqlite
    • executionMode: regular
    • concurrency: 5
    • license: community
    • consumerId: 00000000-0000-0000-0000-000000000000

    storage

    • success: all
    • error: all
    • progress: false
    • manual: true
    • binaryMode: filesystem

    pruning

    • enabled: true
    • maxAge: 168 hours
    • maxCount: 2500 executions

    client

    • userAgent: mozilla/5.0 (windows nt 10.0; win64; x64; rv:142.0) gecko/20100101 firefox/142.0
    • isTouchDevice: false

    Generated at: 2025-09-11T09:16:38.178Z

Hey, I added some more nodes to show you how I would do it. Still it will need 1 line of code in the first Edit Fields node:

Would this work?

2 Likes

Hey and thank you for this solution! That’s interesting too, but doesn’t produce the output I need. The link from the csv header to the field values is missing. I get 27 messages, one of them being the headers only and it’s lost for the other messages in this way.

1 Like

You can include empty cells like so:

1 Like

Thanky you jabbson, this works! What puzzles me: I downloaded your workflow and tried to rebuild it but in the downloaded workflow (and if opened here) the options for Header Row and RAW data are not shown.

This is how it (I guess it should) looks like in my environment and the upper has to be switched on. Otherwise on get’s the result as shown.

Not sure if you are aware, but just in case - no need to rebuild, you can simply copy the workflow and paste it directly into your canvas.

1 Like

Yeah, thanks. Just wanted to make sure I get to know all the needed configurations and not just “get it done” :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.