title: I keep getting 'Undefined: 1' Error in Node.js when trying to call a webAPI
body: <p>Im currently writing some code to read a WebAPI.</p>
  
  <p>C:\Users\XXXX\XXXX\XXXX>node bot.js
  undefined:1</p>
  
  <p>SyntaxError: Unexpected end of JSON input</p>
  
  <pre><code>at Object.parse (native)
  
  at IncomingMessage.&lt;anonymous&gt; (C:\Users\XXXX\XXXX\XXXX\bot.js:82:20)
  
  at emitNone (events.js:91:20)
  
  at IncomingMessage.emit (events.js:185:7)
  
  at endReadableNT (_stream_readable.js:974:12)
  
  at _combinedTickCallback (internal/process/next_tick.js:80:11)
  
  at process._tickCallback (internal/process/next_tick.js:104:9)
  </code></pre>
  
  <p>Here is my code</p>
  
  <pre><code>var http = require('http');
  
  var options = {
      host: 'backpack.tf',
      port: 80,
      path: '/api/IGetPrices/v4?key="personalapikey"',
      method: 'GET'
  };
  
  http.request(options, function(res){
      var body = '';
  
      res.on('data', function(chunk){
          body+=chunk;
      });
  
      res.on('end', function(){
          var price = JSON.parse(body);
          console.log(price);
      });
  }).end();
  </code></pre>
  
  <p>I am very new to node.js and coding in general.  But I have tried like 3 other ways of trying to get this to work.  I'm out of ideas</p>