title: How to read JSON file from URL and assign it into a global variable in NodeJS?
body: <pre><code>var url = 'https://myurl.com/file.json';
  request(url, function (error, response, body) {
    if (!error &amp;&amp; response.statusCode == 200) {
       var jsonObject = JSON.parse(body);
       console.log(jsonObject);
    }
  });
  </code></pre>
  
  <p>I've found the way to get JSON file from URL but it's a little bit struggle for me to assign it to a global variable. In this case, how can I deal with the <code>jsonObject</code>?</p>