Return an Array of Arrays or String Value after Data Manipulation

Hello, I recently starting working with n8n as a possible workflow solution for my company. Currently one of our systems (Fishbowl Inventory) has a very specific format required for their API. While their documentation labels it as JSON, it is really just an array of arrays (effectively a simple CSV array format).

An example of the required format would be as follows:

    ["header1", "header2", "header3"],
    ["data11", "data12", "data13"],
    ["data21", "data22", "data23"]

The thing I’ve been stuck trying to figure out is how I can get n8n to send this ‘array of arrays’ to the API when it seems like n8n is requiring me to return all values in a specific JSON format, or binary data (which have all failed when submitted to the API).

I had hoped I could just directly manipulate the data with JavaScript to get the desired format, but when I do I get the following error if I simply return an array of arrays or a simple string (either as a normal concatenated string or via JSON.stringify()):

ERROR: Code doesn’t return items properly
Please return an array of objects, one for each item you would like to output.

I have also included a sample workflow that more or less demonstrates what I have just described.

It seems like n8n just requires a specific format for all data carried through the workflow, but I’d like to think there is a way to save/output different formats other than the expected JSON.

Any help is greatly appreciated!

Hi @EssXTee,
and welcome to our community!

n8n always expects an object as an output, you can easily achieve this by modifying the last lines of you Code node like this:

return [{
  "api_object": csvData

In this way an item api_object will be passed to the next node and can be easily reused.
Full workflow here:

Let me know if that helps
All the best


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