Jmespath filter in code node not working

@jan thanks for pointing this out! … now finally the penny has dropped for me :slight_smile: … what you see is not actually what you get :wink:

And please correct me if I’m wrong, when the JSON displayed had multiple items (IN THIS CASE 3), i.e.:

[
  {
    "Activity": "Fitness Kurs 1",
    "Trainer": "Monika",
    "Name": "Inge"
  },
  {
    "Activity": "Fitness Kurs 1",
    "Trainer": "Monika",
    "Name": "Eveline"
  },
  {
    "Activity": "Fitness Kurs 2",
    "Trainer": "Anna",
    "Name": "Ingrid"
  }
]

Then the data in the n8n background is:

[
  {
    "json": {
      "Activity": "Fitness Kurs 1",
      "Trainer": "Monika",
      "Name": "Inge"
    },
    "pairedItem": {
      "item": 0
    }
  },
  {
    "json": {
      "Activity": "Fitness Kurs 1",
      "Trainer": "Monika",
      "Name": "Eveline"
    },
    "pairedItem": {
      "item": 1
    }
  },
  {
    "json": {
      "Activity": "Fitness Kurs 2",
      "Trainer": "Anna",
      "Name": "Ingrid"
    },
    "pairedItem": {
      "item": 2
    }
  }
]

And that with the same (DISPLAYED) data, but only 1 item, the data in the background is:

[
  {
    "json": [
      {
        "Activity": "Fitness Kurs 1",
        "Trainer": "Monika",
        "Name": "Inge"
      },
      {
        "Activity": "Fitness Kurs 1",
        "Trainer": "Monika",
        "Name": "Eveline"
      },
      {
        "Activity": "Fitness Kurs 2",
        "Trainer": "Anna",
        "Name": "Ingrid"
      }
    ],
    "pairedItem": {
      "item": 0
    }
  }
]

NOTE: the data displayed looks exactly the same. Only the number of items indicates whether it’s an array or object.

I found out, that you can actually see what’s in the background by feeding the data into a Code node with the following code:

return [$input.all()]

This now finally explains a lot (if not everything) to me, and I keep wondering how I could have missed this essential piece of information …