I have set up a node to receive api data from a system. It comes in JSON format:
{
"ID": "1234567890",
"Event":"Test Node-Red",
"Context":"1234567-00"
}
When it appears in Node-Red, it shows up as a string with quotes
"{"ID":"1234567890","Event":"Test Node-Red","Context":"1234567-00"}"
I want to convert this data to the following format:
{ "fieldData" :
{
"ID":"1234567890",
"Event":"Test Node-Red",
"Context":"1234567-00"
}
}
I thought this might be as easy as using a Change Function and using a JSONata formula to change msg.payload using {"fieldData": msg.payload }
The transformation "works" but because of the quotes that were added when the data came in from the POST it doesn't work. I get:
(The screenshot references NPI instead of ID. That is because the screenshot was taken before I updated my naming)
object
fieldData: "
{"ID":"1234567890","Event":"Test Node-Red","Context":"1234567-00"}"
Which has the extra quotes and therefore won't work with Filemaker's API
Can someone point out a better way to do this please?
Thanks!
Mike