Read CSV file and convert into JSON

Good Morning,

I have been learning n8n for a week, and I have been trying to read a CSV file from a disk and then convert it into JSON file. Pretty standart workflow, but somehow I could not manage it. (There is an old version solution by “Read Binary File” node on forums, but I cannot find it through my nodes on my own Canvas)

1)Screenshot1: The workflow I use.

2)Screenshot2: The node setting for “Read/Write Files From Disk”.

3)Screenshot3: The node setting for “Convert to File”.

Output: Nodes function properly, but after “Read/Write File From Disk” node, it “probably”(just guessing) reads and returns an empty file, so “Convert fo File” functions properly but returns also nothing. (Screenshot4:

Thank you very much for your time.

n8n version: 1.29.1
Running n8n via Docker
Operating System: Windows10 Pro

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I see that the ‘Read/Write Files from Disk’ node is accessing a file on your desktop. Did you actually set up your Docker environment to have access to that directory, and is the node outputting any data? By default, n8n won’t have access to it.

Ah thank you for that! Also a new Docker user here so did not know I have to do that. So first problem is indeed setting up my Docker environment to have access to that directory, let me learn that cause I have no idea how to do it :))

What you need to do is set up a volume inside docker that mounts a local directory. If you’re using docker-compose.yml, you’ll see a section called ‘volumes’. You can add a line to it to map a local directory to a directory inside the docker environment, like:

      - ${DATA_FOLDER}/.n8n:/home/node/.n8n
      - local directory path:/files

After restarting your n8n instance, you can access files in the /files directory.

Please ready Manage data in Docker | Docker Docs for details - especially on Windows you need to pay attention to how you format the file path.

1 Like

Thank you very much bartv! Solved that part:)

Now, I need to update an endpoint with that JSON file, let me spend my own time for that, if I cannot learn/figure out it; I can create another thread.

Once again, thanks a lot!

1 Like

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