Bug: Node transform nodes with filter transforms array with objects to object with objects

Hi,

The “Node transform nodes” transformer changes a indexed array with objects to an object with named keys in some cases, based on the condition. This behavior seems to be a bug.

Based on “Is not empty” filter, produces the correct result.

Based on “Is empty” filter, produces the incorrect result.

My Dataset:

{
  "data": [
    {
      "key": "key",
      "value": "value"
    },
    {
      "key": "key",
      "value": "value"
    },
    {
      "key": "key",
      "value": null
    }
  ]
}

My Transformer JSON export:
export_20240307125017.ndjson (1.0 KB)

Hi @daniellefers,

Thank you for the feedback.
But that’s not a bug.
To bring back the data to the array, you can use this way:

Hi,

If this is not a bug, what is the actual idea behind it for changing te structure from array to an object?

It feels like a workaround to map it back to an array afterwards.

I had the same issue in a different situation. I discovered it depends if you filter the last entities or other ones. If the last ones are filtered the resulting data will be an array, if it’s anywhere else the result will be an object.

This is a bug no doubt about it, the result should be the same type no matter what the input is. I agree that always casting it back to array to fix this bug is a workaround.

Same goes value filter. If you filter the last one the type stays array, if you remove the first one you will get an object:

{
  "test": [
    "qwe",
    "asd"
    ]
}


Versus

Hi @daniellefers and @steven,

Once again, thank you for your report.
Our team has a story to fix this. But for now, you can use the solution I mentioned as a workaround.
Thank you for your understanding.

2 Likes