How to choose values out of one object and combine to new object?

Hello everyone,

I create an object with different topic and combine it with join node. It works very well.

Now I read this object and would like to pick only 3 values and create new object.
This is how my read looks like:

I would like to pick 3 marked values and combine to new object similar to the big one.

I was trying to pick the values with change node like this:

image

Do I need to change the topic for this value? and only after that use join node? This way looks to messy for me, is there an more "elegant" way to solve this?

Using JSONata in a change node:

[
    {
        "id": "e06687fc795a123f",
        "type": "inject",
        "z": "8f2b9e8fd49e667d",
        "name": "",
        "props": [
            {
                "p": "payload.Benutzer",
                "v": "Email@address",
                "vt": "str"
            },
            {
                "p": "payload.StartTimestamp",
                "v": "11.05.22 15:30:20",
                "vt": "str"
            },
            {
                "p": "payload.StopTimestamp",
                "v": "11.05.22 16:25:28",
                "vt": "str"
            },
            {
                "p": "payload.DontNeed",
                "v": "boring",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 90,
        "y": 120,
        "wires": [
            [
                "b3ebcb937c00c86c"
            ]
        ]
    },
    {
        "id": "b3ebcb937c00c86c",
        "type": "change",
        "z": "8f2b9e8fd49e667d",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{\"Benutzer\": payload.Benutzer,\t\"StartTimestamp\": payload.StartTimestamp,\t\"StopTimestamp\": payload.StopTimestamp}",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 320,
        "y": 120,
        "wires": [
            [
                "e0e56cd78e48ea6c"
            ]
        ]
    },
    {
        "id": "e0e56cd78e48ea6c",
        "type": "debug",
        "z": "8f2b9e8fd49e667d",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 530,
        "y": 120,
        "wires": []
    }
]

thank you for your answer, but I would never manage to use it for myself :see_no_evil:

Why not?

If you don't like @ghayne's solution, you could use the change node to delete each value except the ones you want to keep.

Untitled 2

1 Like

hey thank you, I didnt think about deleting. Good idea. Works as expected.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.