title: Does a JSON file on disk, occupy the same amount of space when loaded into a var in memory?
body: <p>I store some JSON files on disk (each very small about 4kB), and load them into a var when required.
  I may have thousands of such files, and if the space they occupy in memory is the same as what they occupy on disk, I would rather load them all into memory at application start.</p>
  
  <p>How can I calculate how much memory (RAM) the file occupies when I create an object from it ?</p>
  
  <p>EDIT: I know how to save JSON files to disk. That is not my question. I am trying to understand how much memory (RAM), a JSON file will occupy when I load it into a var. <strong>If I know the size of the JSON file on disk, how can I calculate how much memory (RAM) it will occupy when I create a javascript object from the file in node.js or in a web browser ?</strong></p>
  
  <p>The files are saved as "plain text files".
  Eg:</p>
  
  <pre><code>{"foo": {
      "bar": 1,
      "foo": {
          "bar": [
              "foo",
              "bar"
          ], 
          "foo":[
               "bar",
               "foo"
          ]
       }
      }
  }
  </code></pre>