var data = msg.payload;
console.log("payload data: length = " + data.length);
data = data.trim();
console.log("trimmed data: length = " + data.length);
msg.payload = JSON.parse(data);
return msg;
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/8Av3EyMQ0o0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/b2fd8ea9-d573-4fae-b0ee-638b8a066a91%40googlegroups.com.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/a6478e20-a193-4477-a3ac-bbd54d412e91%40googlegroups.com.
I've seen this in the past. It is often caused by the Byte order mark character (U+FEFF) that some text editors prepend to a file.Nick
On 10 May 2017 at 14:17, steve rickus <sri...@gmail.com> wrote:
May I ask -- what is logged in the console? Did the length of the input string change before and after using the trim() function?If the string will not parse correctly unless it is trimmed of some funny characters, then it would be good to know so someone else does not have this same problem later. Could you add a file out node to your flow, put the untrimmed data into a temporary file, and post the file here so we can test it?
On Wednesday, May 10, 2017 at 4:08:30 AM UTC-4, Javier Sánchez Buitrago wrote:Thos convert to Object well!Thanks Steve!
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
But in practice, the parsing for the http nodes is done deep within the underlying modules. Not code we'd want to do ourselves for this one very rare edge case.
Nick
Seems sensible to me (at first glance)...
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CACXWFwJyVB3cLMC3aEfOuCK-Yh_uSRPzjfRgridWQ%2BhtoDZR7g%40mail.gmail.com.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/125c2275-f8cb-49e2-853f-a05dbc410720%40googlegroups.com.