title: JavaScript object to JSON Node-RED
body: <p>I'm trying to pass a java script object generated by my red node flow to JSON format. But it is causing me difficulty in knowing how to do it.
  The object script that is obtained is an hour and minute that is written on the screen for example "13:02". In the "result" screen I need to see in JSON format</p>
  
  <pre><code>{"time": "hh: mm"}
  </code></pre>
  
  <p>But I get  "hh:mm" on the screen but i think not in json.</p>
  
  <p>Also when I submit the URL to a client web service and I try to check it the result in JSON I get this error:
  <strong>There was an error parsing JSON data</strong></p>
  
  <p>This is the code:</p>
  
  <pre><code>msg.headers = {"Content-type" : "application/json"}
  var now     = new Date(); 
  var hour    = now.getHours();
  var minute  = now.getMinutes();
  if(hour.toString().length == 1) {
  var hour = '0'+hour;}
  if(minute.toString().length == 1) {
  var minute = '0'+minute;
  }
  msg.payload = hour+':'+minute;
  JSON.stringify({"time": msg.payload});
  return msg;`
  </code></pre>
  
  <p>the debug message show me it is s string:</p>
  
  <p><a href="https://i.stack.imgur.com/v3tae.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v3tae.jpg" alt="enter image description here"></a></p>