title: Loading the contents of a JSON file into JS variables
body: <p><em>Just a small disclaimer: I only have basic knowledge of <code>JS</code> and I'm just starting to learn it, so my code might be really stupid.</em></p>
  <p>I want to take the contents of a <code>.JSON</code> file and assign every entry to a separate <code>JS</code> variable. I am running a local server to be able to read the files as (if I understood this correctly) Chrome would prevent me from accessing local files due to their policy.</p>
  <p>Here's the <code>JSON</code> file contents:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;current&quot; : &quot;current_value&quot;,
      &quot;voltage&quot; : &quot;current_voltage&quot;
  }
  </code></pre>
  <p>And here's my <code>JS</code> script (again this is 100% dumb code as I'm just starting out)</p>
  <pre class="lang-js prettyprint-override"><code>&lt;script src=&quot;/jquery-3.5.1.min.js&quot;&gt;&lt;/script&gt;
  &lt;script&gt;
      var data = $.getJSON(&quot;localhost:8888/data.json&quot;, function(json){
          console.log(json);
          var current = json.current;
      });
      alert(current);
  &lt;/script&gt;
  </code></pre>
  <p>Here's the File Structure:</p>
  <pre><code>L main.html
  L jquery-3.5.1.min.js
  L data.json
  </code></pre>
  <p>What I want to do is to take the value of <code>current</code> in the <code>.JSON</code> file and assign it to the <code>current</code> <code>JS</code> variable. Basically this would be used to have a local web interface to check the real time voltage and current of a battery.</p>
  <p>Thank you for taking your time to read this,<br />
  Huky</p>