Json expression

Hi. Is it possible to get rid of one of the function nodes. I want to combine the two messages sia_code and sia_address in the same function node. I want the output message to be 13ZO


Hi @niclas.w82

Your question is missing some context. Which function nodes are you referring to? Is there a previous topic on the forum with more background to your question?

Sorry forgot the picture

Anyone knows if this is possible?

Yes. You can do that in a change node with JSONata. Have a go yourself, I think you will find it fairly easy since you only need to create a simple string output.

Ok. JSONata is something totally new to me. But tried this. Any idea?

You are some way out in your object/property reference I'm afraid.

You would, I think - hard to say without more context - at least need:


And the same for sia_address.

To get the exact object reference, in the debug window, over the line containing the code or address entries, you will see some small icons appear to the right of the line. Click on the one that looks like >_ and it will tell you that it has copied the path.


Paste that into your code.

Hi @niclas.w82

the JSONata Expressions can only be used in the Change node, where the input is set to the Expression type.

You are showing a screenshot of a Function node - that uses JavaScript.

So rather than use & to join strings, you need to use +.

But you also need to get the reference to the property right as @TotallyInformation describes above.

Getting closer. Tried with + but it doesn't work in the test. Now I get the result I want but in the debug window it just look like this " " and I cannot understand why?

In the Expression editor you are use data.sia.sia_code... but your previous screenshot showed that data was under msg.payload. So you should use payload.data.sia.sia_code in your expression - just as @TotallyInformation suggested.

Because your example message is NOT what is incoming. You've only shown the msg.payload part.

You need the example to look like:

{"payload": {"status": ...... } }

Finally solved!

Thank you all for your help!!!


1 Like