title: node.js and json runtime error
body: <p>I am using node.js and trying to parse the JSON body of a request.
  I am getting the following error:</p>
  
  <pre><code>undefined:0
  
  ^
  SyntaxError: Unexpected end of input
      at Object.parse (native)
      at IncomingMessage.&lt;anonymous&gt; (C:\node\xxxx.js:36:14)
      at IncomingMessage.emit (events.js:64:17)
      at HTTPParser.parserOnMessageComplete [as onMessageComplete] (http.js:130:23)
      at Socket.ondata (http.js:1506:22)
      at TCP.onread (net.js:374:27)
  </code></pre>
  
  <p>I am doing:</p>
  
  <pre><code>     request.on('data', function(chunk)
      {
      data+=chunk;
      });
       // and in the end I am doing
       obj = JSON.parse(data);  // it's complaining at this point.
  </code></pre>
  
  <p>input is:</p>
  
  <pre><code>{
      "result": "success",
      "source": "chat"
  }
  </code></pre>