diff --git a/io/emoncms/88-emoncms.html b/io/emoncms/88-emoncms.html index 277a504f..5551d1d0 100644 --- a/io/emoncms/88-emoncms.html +++ b/io/emoncms/88-emoncms.html @@ -32,7 +32,8 @@ diff --git a/io/emoncms/88-emoncms.js b/io/emoncms/88-emoncms.js index b84b2ec8..c6b914dd 100644 --- a/io/emoncms/88-emoncms.js +++ b/io/emoncms/88-emoncms.js @@ -43,10 +43,15 @@ module.exports = function(RED) { else { http = require("http"); } this.on("input", function(msg) { this.url = this.baseurl + '/input/post.json?'; - if (msg.payload.indexOf(':') > -1) { - this.url += 'json={' + msg.payload + '}'; - } else { - this.url += 'csv='+msg.payload; + if (typeof(msg.payload) !== "string") { + this.url += 'json=' + JSON.stringify(msg.payload); + } + else { + if (msg.payload.indexOf(':') > -1) { + this.url += 'json={' + msg.payload + '}'; + } else { + this.url += 'csv='+msg.payload; + } } this.url += '&apikey='+this.apikey; var nodegroup = this.nodegroup || msg.nodegroup;