request / request-promise

The simplified HTTP request client 'request' with Promise support. Powered by Bluebird.
ISC License
4.77k stars 297 forks source link

JSON not being parsed even when set to 'true' #198

Closed jstrother closed 7 years ago

jstrother commented 7 years ago

Hi,

I'm having issues getting the JSON to display in my console even when it is set to true. I know I'm getting a response from the API I'm using, but it only displays as '[object Object]'.

const rp = require('request-promise'),
   leagues = {
      uri: 'https://soccer.sportmonks.com/api/v2.0/leagues?{SUPER_SECRET_API_KEY}',
      json: true
    };
return rp(leagues)
  .then(leagues => {
    console.log(`leagues: ${leagues}`);
    return leagues;
  })
  .catch(error => {
    console.log(`leagues error: ${error}`);
  });

Am I missing something? Or is the package not firing on all cylinders? I'm using v4.2.1

Thanks!

jstrother commented 7 years ago

Never mind. A youngster not coding correctly here. I got it fixed. I can't console.log these in a template string. Feel free to close this issue.

analog-nico commented 7 years ago

Alright, no problem. Happy coding! :)