title: How do I insert json code in a specific area in python?
body: <p>How do I insert data from a json dump to a specific area and not just the end of the file? </p>
  
  <p>For example, if I have a json file:</p>
  
  <pre><code>{
    "name":"John Doe",
    "gender": "M",
    "married": true,
    "children": [
      {
        "name": "Mark Doe",
        "age": 5,
        "gender": "M"
      }
    ]
  }
  </code></pre>
  
  <p>As wierd as it sounds, if John Doe had another child, and I had a python program which will add the child to the json file, I would do this, right?:</p>
  
  <pre><code>import json
  
  with open("johnsjson.json", "a") as f:
    suzydoe = {"name": "Suzy", "age": 5, "gender": "F"}
    json.dump(suzydoe, f)
  f.close()
  </code></pre>
  
  <p>But, if I do that, it gives an output:</p>
  
  <pre><code>{
    "name":"John Doe",
    "gender": "M",
    "married": true,
    "children": [
      {
        "name": "Mark Doe",
        "age": 5,
        "gender": "M"
      }
    ]
  } {"name":"Suzy","age":5,"gender":"F"}
  </code></pre>
  
  <p>But, I want it to insert the json into the Children object. Can anyone help.
  <em>and also, the code above is just an example to my actual code</em></p>
  
  <p><em>Edit: Typo in the "children" formatting</em></p>