title: Add value to existing JSON file
body: <p>I would like to define the following simple function:</p>
  
  <pre><code>def add_to_json(self, json, node_name, value_name, value):
      json[node_name][value_name] = value
  </code></pre>
  
  <p>where <code>json</code> is a JSON file to modify, so it would be called like this:</p>
  
  <pre><code>jsonToModify = json.load(open(path_to_jason_file)) # path is of the type: "C:/Users/path/to/file.json"
  self.add_to_json(jsonToModify, "NodeName", "ValueName", self.stuff)
  </code></pre>
  
  <p>I have searched how to use the <code>json.load()</code> function, but I get this error if I give it a string:</p>
  
  <p><a href="https://i.stack.imgur.com/MbKkH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MbKkH.png" alt="enter image description here"></a></p>
  
  <p>I am not sure on what to give to <code>json.load</code>; how can I give the path to my file as an input?</p>