Spliting with functions

Hello guys,
sorry for now, I dont use json so often,
so i have a json file, with one data entry that I want to split:

I tried a couple of JavaScript Codes in Function to split and grab only the value from first_name, but I don’t know how.

Of course this is only one example, I have several entries under data.
In the end I want to sort all first_names under the type Employee.

Maybe some of you guys have a hint for me. Thanks

"success": true,
"data": [
"type": "Employee",
"attributes": {
"id": {
"label": "ID",
"value": 111111,
"type": "integer",
"universal_id": "id"
"first_name": {
"label": "First name",
"value": "Max",
"type": "standard",
"universal_id": "first_name"


return items[0].json.data.map(item => {
  return {
    json: item

I have a column with type and a lot of entries with the same value ‘Employee’
and one column with attributes with a new string with includes all data after.
So a bit close but still lost.
But now I need the next level where I have column with name, id etc.

The Item List node along with the function item node below should do it:

const { attributes } = item

const keys = Object.keys(attributes)

for (key of keys) {
  item[key] = attributes[key].value

delete item.attributes;

return item
Example workflow

Thanks Ricardo,
I hope this example will also help me to understand more about javascript and n8n :slight_smile:
Good example , :+1:

1 Like