Apply transformation on nested object fields (based on dot notation)

Hi @drmibell,

I got it working using the Jsonata transforms. And it works fine!

However few days afterwards my Node-RED became suddenly completely unresponsive, and I had no clue what was causing that. So I started experimenting with profiling in Node-RED (via ClinicJs, my message tracer and my own profiler), and via all ways it immediately became visible that my Jsonata transforms were causing this:

image

Jsonata does not modify (see here) the original input objects, instead it deep clones the input msg and it transforms the clone and returns that modified clone.

However my new custom node - for which I need tranformations - is used to handle images from camera streams, so those messages contain LOTs of data. The image cloning was causing all my troubles, because that is something that need to be avoided as much as possible when dealing with images.

So I ended up writing my own custom transformation (with my own expression syntax) at the end, and that works MUCH faster because I now transform the original input message ...

Summarized: the Jsonata transforms work very well, but be aware about the performance impact! It all depends on the amount of data in your input messages...

1 Like