Un-deprecate "string or buffer" autodetection in mqtt-in node

In MQTT in node auto-detect mode should include trying to parse JSON · Issue #3410 · node-red/node-red · GitHub (by @dceejay and @knolleary) the ability to auto-detect and parse JSON in an MQTT message was added. At the same time the old auto-detect logic "string or buffer" was deprecated.

I have a flow that just stores MQTT messages in a log without looking at their contents at all.

I could set the output to "a Buffer" and it would work. However, this also makes the message hard to read in debug nodes, so the "string and buffer" mode is perfect for this. Strings can be stored in the log just like buffers.

The "parsed JSON object, string or buffer" mode adds additional complication: I have to re-stringify the messages before I can put them in the log.

Can we un-deprecate the "string or buffer" mode?

It may have been deprecated - but wasn't removed...

1 Like

what are you using to log?

There are smarter nodes for logging objects - for example node-red-contrib-flogger

I know, I'm using it very successfully, hence the feature request to un-deprecate it. It is very useful so it would be great if it would continue to work in a future version of Node-RED.

Sending it off to Loki with an http request node.

not sure why you have to stringify the object then. I am almost certain the HTTP Request node stringifies the payload automatically?

I'm putting it into another object together with metadata about the MQTT message: {topic: ..., qos: ..., retain: ..., payload: ...}.

Must admit I'm not aware of any current intention to remove this (@Steve-Mcl ?) - so yes I have no objection to leaving it there and removing the comment instead.

1 Like

It was my hope to remove it in the next major release

Re: depreciated: MQTT payload auto parsing improvements by Steve-Mcl · Pull Request #3530 · node-red/node-red · GitHub

But the OP has highlighted a use case, I may leave it for a later major release (or never :man_shrugging: )

NOTE: However, if the OP wishes for me to remember I said that ↑ an issue should be raised so it is not forgotten :smiley:

1 Like

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