Capture only label name with data

Hi everyone,

I wanted to know if it is possible to capture only the property (label) from the Set node.
In the below example, my goal would be to output this: “Criticality,Retention”.

Appreciate any guidance/support.

Hey @wdb1, this will be tricky.

n8n relies on JSON for its data which uses key/value pairs. Meaning there’s always a key/column header in n8n itself.

So the closest you can get is a column with a name of your choice and the field names in them using Function code like this in your example:

return [{
  json: {
    myKeys: Object.keys(items[0].json).join(',')

This uses Object.keys() to read the json keys from your first item, then .join() to create the string you want using each key:


Of course you can afterwards reference this value alone without the column header, for example if you want to write it to a file or send it out via email.

Hope this helps! Let me know if you have any questions on this!

Thanks… This has helped. !

1 Like

Sweet, glad to hear. Thanks a lot for confirming!

How we can filter the result to bring everything except any variable with “{“value”: []}”?

Hey @wdb1,

What sort of format are you expecting the data to be in? Are you expecting the same format as the Set node just without the empty key?

Hi @jon , I wanted to capture only the label name removing any label that is equal: “{“value”: []}”
The expected result on the above example would be Criticality,Retention