Set node help needed

Hello.

I have a little problem with setting set node in my case.
Here is what I need to archive:

{
“2685”: {
“105”: 21.99,
“106”: 24.99
},
“2687”: {
“105”: 21.99,
“106”: 23.99
}
}

or just

{
“2685”: {
“105”: 21.99
},
“2687”: {
“105”: 21.99
}
}

I try to set it right in set node, but the result is ex.
[
{
“1052793336”: “105: 59.99”
},
{
“1052810944”: “105: 59.99”
},
{
“1052814268”: “105: 59.99”
},
{
“1052814889”: “105: 54.99”
},
{
“1052814946”: “105: 54.99”
},
{
“1052815045”: “105: 64.99”
},
{
“1052815166”: “105: 64.99”
},
{
“1052815184”: “105: 59.99”
}
]

Hi @tomfat,

You want an object in your result but you are adding a string. However, you can set an object in a Set Node.

Hope it helps.

1 Like

Hi.

Thank you for answer, but it not solve my problem.

Result:

Pattern:
{
“1052793336”: {
“105”: 21.99
},
{
“1052810944”: {
“105”: 21.99
},
{
“1052814268”: {
“105”: 21.99
},
{
“1052814889”: {
“105”: 21.99
},
{
“1052814946”: {
“105”: 21.99
},
{
“1052815045”: {
“105”: 21.99
},
{
“1052815166”: {
“105”: 21.99
},
{
“1052815184”: {
“105”: 21.99
}
}

there is a difference with closing brackets

Hi,

It means you don’t want objects of array. It can be done in Function Node.

n8n provides us a great customizability with Function Node. You can find a lot information about Javascript on communities like Stackoverflow.

It looks like solution. I will stydy more about JS. Can I ask how to use data from previous node in this case instead of mock data? I really don’t use function node very often.

Hi,

n8n Documentation is a good point to start. To see real life examples filtering workflows that contain Function Node is a good option too.

1 Like