Character limit in field size(JSON)?

Hi,
I am running this flow and in Set7 I add a value from the webhook1

it returns 20 values, but that field is only populated in first item of the results. This fields has very large string. Is there any character limitation? Thank you very much.

It should not have a limit you would run into. I think something else is going on here. Can you please create a simple example workflow which shows the problem you are having. We can then check it and tell you what has to get changed.

I will try to create a simple, not very familiar with these things yet :slight_smile: , but basically webhook 1 returns this one unique value in the body:

[

{

“headers”: {

“user-agent”: “axios/0.18.1”,

“content-length”: “299”,

“accept”: “application/json, text/plain, /”,

“content-type”: “application/json”,

“x-forwarded-for”: “XXXX”

“accept-encoding”: “gzip”

},

“params”: {

},

“query”: {

},

“body”: {
“Key”: “Xjasjdjasjdajsdjajsdjajsd”

}

}

]

and the set7 returns a result of values , but has you can see only the first result has the Key, the rest is empty

[

{

“name”: “Mary”,
“Account”: 1,

“Key”: “XXjasjdjasjdajsdjajsdjajsd”

},
{

“Name”: “John”,
“Account”: 2

},
{

“Name”: “John”,
“Account”: 3

},

Thank you

Here we go, was able to replicate one :slight_smile:

{
  "name": "Testsplit",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        310,
        -3550
      ],
      "disabled": true
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n     json: {\n       \"name\": \"Mary\",\n       \"Account\": 1\n     } \n  },\n   {\n     json: {\n       \"name\": \"John\",\n       \"Account\": 2      \n     } \n  },\n   {\n     json: {\n       \"name\": \"John\",\n       \"Account\": 3      \n     } \n  },\n]\n"
      },
      "name": "Function18",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        490,
        -3530
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "Name",
              "value": "={{$json[\"name\"]}}"
            },
            {
              "name": "ID",
              "value": "={{$json[\"Account\"]}}"
            },
            {
              "name": "Key",
              "value": "={{$node[\"Function19\"].json[\"Key\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set21",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        1050,
        -3410
      ]
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n     json: {\n       \"Key\": \"XASDASDASDSD\"\n     } \n  },\n]\n"
      },
      "name": "Function19",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        490,
        -3320
      ]
    }
  ],
  "connections": {
    "Function18": {
      "main": [
        [
          {
            "node": "Set21",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function19": {
      "main": [
        [
          {
            "node": "Set21",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start": {
      "main": [
        [
          {
            "node": "Function19",
            "type": "main",
            "index": 0
          },
          {
            "node": "Function18",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "id": "9"
}

Your example has two problems:

  1. It connects two different nodes with the same input. That can not work as the node would execute 1x for each input and the data would so not be related to each other. If you want to do that, you have to use a Merge-Node.
  2. One nodes has 3 items and the other just 1. Meaning only the first of the 3 items would receive data from the other. For that reason do you have to say specifically that you always want to reference data of the first item via $item(0).

Here the fixed example:

{
  "nodes": [
    {
      "parameters": {
        "functionCode": "return [\n  {\n     json: {\n       \"name\": \"Mary\",\n       \"Account\": 1\n     } \n  },\n   {\n     json: {\n       \"name\": \"John\",\n       \"Account\": 2      \n     } \n  },\n   {\n     json: {\n       \"name\": \"John\",\n       \"Account\": 3      \n     } \n  },\n]\n"
      },
      "name": "Function18",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        520,
        330
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "Name",
              "value": "={{$json[\"name\"]}}"
            },
            {
              "name": "ID",
              "value": "={{$json[\"Account\"]}}"
            },
            {
              "name": "Key",
              "value": "={{$item(0).$node[\"Function19\"].json[\"Key\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set21",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        1170,
        390
      ]
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n     json: {\n       \"Key\": \"XASDASDASDSD\"\n     } \n  },\n]\n"
      },
      "name": "Function19",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        520,
        540
      ]
    },
    {
      "parameters": {
        "mode": "passThrough"
      },
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 1,
      "position": [
        810,
        370
      ]
    }
  ],
  "connections": {
    "Function18": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function19": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Set21",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Thank you Jan, the example itself works perfectly, but strangely again it doe not work and I get same results, but it seems well formed and I validated. It is a mystery. Could it be same issue with webhook generating 1 result first and then next api generates the array of APIs and thus only still 1 value from original webhook result and not the array results of last API call. Going coconuts with this :smiley: .

Do not understand. Did you change your expressions accordingly to $item(0)? If you did, it can not be the problem. If you did not, it probably is the problem.

1 Like

Jeez, that was the issue, I failed to see that, I had $node instead of $Item, a 1000 Thanks, you just gave me more hours of sunlight today and less white hair, :smiley: :hugs: :laughing: .

Glad to hear that it helped. Have fun!

1 Like