Convert List Items to array

Describe the issue/error/question

I have a list I need to create a JSON body from, for an HTTP POST
First few records:

"Account Type": "DebitNetPay",
"Account Description": "1210 - Bank - SHM",
"Debit": 0,
"Credit": 100.86
"Account Type": "DebitTax",
"Account Description": "1210 - Bank - SHM",
"Debit": 0,
"Credit": 35.85
"Account Type": "BenefitCompanyContribution",
"Account Description": "Employee Life Insurance - Benefit Company Contribution",
"Debit": 0.69,
"Credit": 0

The list is basically 4 columns, 20+ records
I am only getting record 1 in the body

"title": "Payroll Entry",
"company": "SHM",
"accounts": [
        "account": "{{$json["Account Description"]}}",
        "debit_in_account_currency": {{$json["Debit"]}},
        "credit_in_account_currency": {{$json["Credit"]}}
"posting_date": "{{$node["Function"].json["posting_date"]}}",
"voucher_type": "Journal Entry",
"naming_series": "JV-"

I need all list items to be in the “accounts” array

I searched samples and posts but haven’t ended up with any more understanding.

Information on your n8n setup

  • Running n8n via

Hi @Mike_Z,
i created a sample workflow using our Function Node to convert your data before making a HTTP Request.

The posted body looks like this

Thanks, Marcus!
Your example also illustrated the use of body parameters. I was building a monolithic body, basically text with template references to the data items. It wasn’t pretty.
I am migrating my clients integration flows away from Integromat/Make and, just as when we migrated from Zapier to Integromat, there’s a bit of a learning curve. Looks to be worth it, though.

Best regards,

1 Like