HTTP - Optimize Response - Nested Arrays

Describe the problem/error/question

Hi! I’m using an HTTP tool to get a list of transactions. I want to Include only some fields, but the “Include Field” option doesn’t seem to work with the info within JSON arrays.

My closest attempt is setting “transactions[0].amount” which successfully returns only the amount of the first transaction. But I would like to return only the amount of all transactions. I tried with “”, “[*]” and others.

What is the error message (if any)?

None.

Please share your workflow

Share the output returned by the last node

Output:

Response body

Download

{
  "data": {
    "transactions": [
      {
        "id": "6aef2af5-f0c2-461b-aada-e573c75c5197",
        "date": "2025-07-01",
        "amount": -2255410000,
        "memo": null,
        "cleared": "uncleared",
        "approved": true,
        "flag_color": null,
        "flag_name": null,
        "account_id": "915f44a2-a5c8-4a60-8de5-8165d70ae7ff",
        "account_name": "Banco",
        "payee_id": "3b1ff21c-c09e-40b6-8dde-4468336965da",
        "payee_name": "Transfer : Credit Card - USD",
        "category_id": null,
        "category_name": "Uncategorized",
        "transfer_account_id": "46cc1054-cff3-4013-95a2-253a7794380c",
        "transfer_transaction_id": "b5505f9e-ff5b-4607-a4ef-1ecb1a2b7d94",
        "matched_transaction_id": null,
        "import_id": null,
        "import_payee_name": null,
        "import_payee_name_original": null,
        "debt_transaction_type": null,
        "deleted": false,
        "subtransactions": []
      },

I would like it to be:

Response body

Download

{
  "data": {
    "transactions": [
      {
        "amount": -2255410000,
      },

Information on your n8n setup

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

I couldn’t manage to edit my post. Here are some screenshots, I’m testing with the memo field.

if [*] or works or not will depend on api you are using to fetch data.

but after fetching you can use code node and do some things like

const result = data.data.transactions.map(transaction => ({
  amount: transaction.amount
}));

which will give you only transactions.

That’s interesting. Sorry I’m quite new, just built my first agent. Since I’m using HTTP API tools, should I add a code tool node as well to my mcp? I’m afraid that approach wouldn’t work either way, I’m trying to trim the JSON response because it’s too large for the LLM.

Maybe I should do the HTTP request as a workflow instead?

yes you can fetch data and use code node to filter out only fields required and use them.

1 Like

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