title: Output from function in Node-Red showing as [object OBJECT] in html. template
body: <p>ok, it's my first day....</p>
  
  <p>I'm trying to make a little Node-Red app. It might seem silly but its actually a fun example of something that I need to do that is a lot less humorous.
  A HTTP Input triggers a HTTP Request to an Urban Dictionary API and scrapes random definitions for the term "Honey Badger".</p>
  
  <p>Then a function chews the string to pieces and pulls out just the actual definition and discards all the meta junk.</p>
  
  <p>The String is then passed to a template that contains a load of HTML before and after the {{payload}} line to produce a page that has the content from Urban Dictionary displayed, with a random definition displayed on each page load.</p>
  
  <p>I'm getting everything that I want, and debugging the output of my template is showing the UD content in the log however in the browser all I'm getting is [object OBJECT] where my paragraph of text should be.</p>
  
  <p>I understand that this is because the function is outputting an object, not a string. </p>
  
  <p>I don't really have a full understanding of what an object is.</p>
  
  <p>I've never, ever coded any JS before, this is where I'm starting from.</p>
  
  <pre><code>[{"id":"65001585.8c9564","type":"http in","z":"4737d790.fefe58","name":"badger","url":"/Badger","method":"get","upload":false,"swaggerDoc":"","x":76,"y":72,"wires":[["980800c8.6789f","ab39736b.ffbfd"]]},{"id":"980800c8.6789f","type":"http request","z":"4737d790.fefe58","name":"URBAN DICTIONARY","method":"GET","ret":"txt","url":"https://urban.now.sh/random/Honey Badger","tls":"","x":269,"y":106,"wires":[["c0ff5132.822508"]]},{"id":"ab39736b.ffbfd","type":"http response","z":"4737d790.fefe58","name":"http response","x":1016.5551147460938,"y":75.22221374511719,"wires":[]},{"id":"e98c98a8.0a9a28","type":"template","z":"4737d790.fefe58","name":"Template","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"&lt;!DOCTYPE html&gt;\n&lt;HTML&gt;\n\n\t&lt;HEAD&gt;\n\t\t&lt;TITLE&gt; [ H O N E Y B A D G E R ] &lt;/TITLE&gt;\n\t\t&lt;META HTTP-EQUIV=\"refresh\" CONTENT=\"300\"&gt;\n&lt;style&gt;\np.minortext\n{\n    font-family: \"Arimo\";\n    color:#A9A9A9\n}\np.majortext\n{\n    font-family: \"Impact\";\n    color:black\n    size:20\n}\n\n&lt;/style&gt;\n&lt;/head&gt;\n\n\t&lt;BODY&gt;\n\t        &lt;CENTER&gt;\n\t            &lt;Table Width = \"100%\" Bgcolor=\"#A9A9A9\"&gt;&lt;TR&gt;&lt;TD ALIGN = \"CENTER\"&gt;\n\t              &lt;a class=\"weatherwidget-io\" href=\"https://forecast7.com/en/n34d93138d60/adelaide/\" data-font=\"Roboto Slab\" data-mode=\"Current\" data-days=\"3\" data-shadow=\"#000000\" data-accent=\"#000000\" data-textColor=\"#ffffff\" data-highColor=\"#ffffff\" data-lowColor=\"#ffffff\" data-sunColor=\"#ffffff\" data-moonColor=\"#ffffff\" data-cloudColor=\"#ffffff\" data-cloudFill=\"#ffffff\" data-rainColor=\"#ffffff\" data-snowColor=\"#ffffff\" &gt;Adelaide, South Australia, Australia&lt;/a&gt;\n&lt;script&gt;\n!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=\"https://weatherwidget.io/js/widget.min.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"weatherwidget-io-js\");\n&lt;/script&gt;\n&lt;/td&gt;&lt;td align = \"center\"&gt;\n\n\n&lt;/td&gt;\n\n\n\n&lt;/TD&gt;&lt;TD ALIGN = \"RIGHT\"&gt;&lt;IMG SRC=\"LogIn.PNG\"&gt;       &lt;/TD&gt;&lt;/TR&gt;&lt;/Table&gt;\n\t        &lt;Table Width = \"500\" Height = \"620\" Border = \"0\"&gt;\n\t            &lt;TR Width = \"500\" Height = \"320\"&gt;\n\t                &lt;TD Width = \"500\" Height = \"320\" VALIGN = \"CENTER\"&gt;\n\t\t&lt;CENTER&gt;\n\t\t\t    &lt;FONT SIZE = \"20\"&gt;\n                    &lt;p class=\"majortext\"&gt;\n                        &lt;IMG SRC=\"HoneyBadger.PNG \" ALT=\"HoneyBadger\"&gt;&lt;BR&gt;\n\t\t\t\t        &lt;B&gt;H O N E Y B A D G E R&lt;/B&gt;\n\t\t\t        &lt;/P&gt;\n\t\t\t    &lt;/FONT&gt;\n\t\t\t        &lt;/TD&gt;\n\t\t\t     &lt;/TR&gt;\n\t\t\t     \t            &lt;TR Width = \"500\" Height = \"300\"&gt;\n\t                &lt;TD Width = \"500\" Height = \"300\" VALIGN = \"TOP\"&gt;\n\t\t\t&lt;CENTER&gt;\n\t\t\n\t\t\t&lt;p class=\"minortext\"&gt;\n\t\t\t    \t\t\t    &lt;FONT SIZE = \"5\"&gt;\n\t\t\t    {{{payload}}}\n            &lt;/P&gt;\n\t\t&lt;/CENTER&gt;\n\t\t    &lt;/TD&gt;\n\t\t    &lt;/TR&gt;\n\t\t    &lt;/TABLE&gt;\n\t\t&lt;/CENTER&gt;\n\t&lt;/BODY&gt;\n&lt;/HTML&gt;\t\t\t    \n\n","output":"str","x":830.0000610351562,"y":108.55557250976562,"wires":[["ad7d02ac.52565","ab39736b.ffbfd"]]},{"id":"ad7d02ac.52565","type":"debug","z":"4737d790.fefe58","name":"","active":true,"console":"true","complete":"payload","x":1013.3883666992188,"y":153.77764892578125,"wires":[]},{"id":"c0ff5132.822508","type":"function","z":"4737d790.fefe58","name":"test","func":"var parts = msg.payload.split(\"definition\");\nvar message1 = { payload: parts[0] };\nvar message2 = { payload: parts[1] };\nvar msg2parts = message2.payload.split(\"URL\");\nvar msgsparts1 = {payload: msg2parts[0]};\nvar msgsparts2 = {payload: msg2parts[1]};\n\n\nreturn msgsparts1;\n","outputs":"1","noerr":0,"x":446.75921630859375,"y":106.75926971435547,"wires":[["e132da2c.78b1a8"]]},{"id":"e132da2c.78b1a8","type":"change","z":"4737d790.fefe58","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"\"\"","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"\\n","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"n\\","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":":","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"\"\"\"","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":".\",\"\"","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"\\","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"\"","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"example","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":628.8887939453125,"y":107.99996948242188,"wires":[["e98c98a8.0a9a28"]]}]
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/GkOES.png" alt="enter image description here"></p>