title: How remove element for json file in C#
body: <p>I have json file Users.json and I want delete one element. This is the structure:</p>
  
  <pre><code>{
  "1": {
      "Username": "1",
      "Name": "1",
      "AccessGroup": "Administrators"
  },
  "2": {
      "Username": "2",
      "Name": "2",
      "AccessGroup": "Supervisors"
  },
  "3": {
      "Username": "3",
      "Name": "3",
      "AccessGroup": "Administrators"
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And the code:</p>
  
  <pre><code>public void DeleteUser(Users.User user)
      {
          String filename = USERS_PATH;
  
          try
          {
              if (File.Exists(filename))
              {
                  var data = DeserializeFromFile&lt;Dictionary&lt;String, User&gt;&gt;(USERS_PATH);
                  foreach (var item in data)
                  {         
                      if (user.Username == data[item.Key].Username)
                      {
                          data.Remove(user.Username);
                          break;
  
                      }
  
                  }
  
              }
  
          }
          catch (Exception)
          {
              throw new ArgumentException("User has not deleted");
          }
      }
  </code></pre>
  
  <p>After that iteration the file is the same like before. Where do I wrong? Thanks in advance.</p>