title: How to save data from JSON to a variable in NodeJS
body: <p>I'm new in Node.js, I have a problem.</p>
  
  <p>I would like to save data from JSON object which I have downloaded from github API.</p>
  
  <pre><code>var http = require("http");
  var express = require('express');
  var app = express();
  var github = require('octonode');
  var client = github.client();
  
  app.set('port', process.env.PORT || 8000);
  
  var server = app.listen(app.get('port'), function() {
     console.log('Express server listening on port ' + server.address().port);
  });
  
  app.get('/getUsers', function (req, response) {
  
     response.writeHead(200, {'Content-Type': 'text/json'});
     var result;
  
     client.get('/users/angular/repos', {}, function (err, status, body, headers) { 
         result = response.write(JSON.stringify(body));
         console.log(result); //JSON object
         return result;
  });
  
  console.log(result); //undefined
  
  });
  </code></pre>
  
  <p>How can I save an data from object to single variable?</p>
  
  <p>(I want to then transform it to an Array and take some useful data).</p>