Function Node - need help

Hi there,

i know i need to learn about the function node, but till now i'm working without it and i'm happy with it. TILL today with this function:

The sample shows this:

{
    "body": "Test"
}

But i need the input of the payload instead of "Test".

How do i need the set it ? i tried and googled for it but no success.
Thx in advance

Felix

Hi, the function node needs to contain valid Javascript and if you aren't familiar, there are some excellent short courses and tutorials that will give you the basics and more.

Your post doesn't really contain enough information to help. What you've given is actually valid JSON not JavaScript. JSON is a serialisable data format closely related to but not the same as a JavaScript object.

A typical function node might look like:

return {
   "body": msg.payload,
}

Which does very little obviously but does output a new message based on the input message.

Hi,
i found out how to edit the "body" with the -change node-

thx for your answer

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