JSON to CSV files unique

Hello,
I want to create a flow as follows: I retrieve the JSON files from an FTP server, download them, convert them to CSV, and then store them in another FTP server. However, I want to convert the files to CSV one by one, not like I do, where all the JSON files are converted into a single CSV file.
The nodes used are:
List FTP
Download FTP
Extract from JSON file
Split Out

I stopped here because if each file has 5 JSON objects, and I want each JSON object to be a row in the CSV file, it creates a single final file with 10 items.

Does anyone know how to fix this?

Hey @Josep_Garcia

Replace your current flow after “List FTP” with a Loop Over Items:

When clicking ‘Execute workflow’ → List FTP → Loop Over Items → Download File FTP → Extract from File → Convert to File

Configure Loop Over Items:

  • Connect it right after “List FTP”
  • This will process each JSON file one at a time, completely finishing one before starting the next

Let me know if that works

1 Like

Thanks for the solution.
But unfortunately, it didn’t work.
From what I’ve seen in n8n, the loop is no longer necessary, because all actions are executed for each item. What happens in this case is that it executes everything twice, with the same result. I think the problem is with the split out, but I don’t know how to fix it.

@Josep_Garcia ,

You’re right ,the Split Out node is creating duplicate items, and since n8n processes each item automatically, you’re getting everything executed twice with the same data

Remove Split Out node: If your API returns an array of customers, n8n will automatically process each one individually through the subsequent nodes

Use a Loop node to handle one file at a time like this example:

An interesting one.

I finally got it like this:

2 Likes

Nice one, if my response helped you, you can mark it as an answer :clinking_beer_mugs:

1 Like

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