title: Update JSON file in Python
body: <p>The .json file I want to update has this structure:</p>
  
  <pre><code>{
    "username": "abc",
    "statistics": [
      {
        "followers": 1234,
        "date": "2018-02-06 02:00:00",
        "num_of_posts": 123,
        "following": 123
      }
    ]
  }
  </code></pre>
  
  <p>and I want it to insert a new statistic like so</p>
  
  <pre><code>{
    "username": "abc",
    "statistics": [
      {
        "followers": 1234,
        "date": "2018-02-06 02:00:00",
        "num_of_posts": 123,
        "following": 123
      },
      {
        "followers": 2345,
        "date": "2018-02-06 02:10:00",
        "num_of_posts": 234,
        "following": 234
      }
    ]
  }
  </code></pre>
  
  <p>When working with </p>
  
  <pre><code>with open(filepath, 'w') as fp:
      json.dump(information, fp, indent=2)
  </code></pre>
  
  <p>the file will always be overwritten. But I want the items in statistics to be added. I tried reading the file in many possible ways and append it afterwards but it never worked.<br><br>
  The data is coming written in the information variable just like</p>
  
  <pre><code>information = {
    "username": username,
    "statistics": [
        {
            "date": datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
            "num_of_posts": num_of_posts,
            "followers": followers,
            "following": following
        }
    ]
  }
  </code></pre>
  
  <p>So how do I update the .json file that my information is added correctly?</p>