Aufrufen einer JSON-API mit Node.js

Ich versuche, das Facebook-Profilbild des Benutzers in meine Anwendung einzuloggen. Facebooks API gibt das anhttp://graph.facebook.com/517267866/?fields=picture Gibt die richtige URL als JSON-Objekt zurück.

Ich möchte die URL zum Bild aus meinem Code entfernen. Ich habe Folgendes versucht, aber hier fehlt mir etwas.

 var url = 'http://graph.facebook.com/517267866/?fields=picture';

 http.get(url, function(res) {
      var fbResponse = JSON.parse(res)
      console.log("Got response: " + fbResponse.picture);
    }).on('error', function(e) {
      console.log("Got error: " + e.message);
 });

Das Ausführen dieses Codes führt zu folgenden Ergebnissen:

undefined:1

^
SyntaxError: Unexpected token o
    at Object.parse (native)

Antworten auf die Frage(5)

Ihre Antwort auf die Frage