How can I select part of json with Function or Set node

Hi @Alexis, welcome to the community :tada:

@BillAlex beat me to it since I had to answer the door :smiley:, but let me post my suggestion anyway:

Since you specifically asked for a Function node, I think this snippet should do the job based on your example data:

return [{
  json: {
    stores: items[0].json.stores.map(s => { return {
        name: s.name,
        type: s.type
      }
    })
  }
}];

image

Here is an example you can copy straight into your canvas:

Example Workflow
1 Like