title: How to deserialize JSON file into List<T> c#
body: <p>I can't deserialize JSON file wich contain multiple objects of type <code>Account</code>. Here is how I build my <code>data.json</code> file. I have a List of Accounts <code>List&lt;Account&gt;</code> which is serialize as usual. I separate each object in json file by adding a new line.</p>
  
  <pre><code>List&lt;Account&gt; listOfAccounts = new List&lt;Account&gt;();
  if (listOfAccounts != null)
  {
      foreach (var item in listOfAccounts)
      {
          JavaScriptSerializer ser = new JavaScriptSerializer();
          string outputJSON = ser.Serialize(item);
          // I added Environmetn.NewLine to separate each account in json file.
          File.AppendAllText("data.json", outputJSON + Environment.NewLine);
      }
  }
  </code></pre>
  
  <p>Now, when I'm trying to retrieve all Accounts from the JSON file to <code>List&lt;Account&gt;</code> I get an error: <code>System.ArgumentException: 'Invalid JSON primitive:</code> <br>
  Please help to find the solutin, so I can get all objects from the JSON file.</p>
  
  <pre><code>private void JsonFileLoad()
  {
      if(File.Exists("data.json"))
      {
          String JSONtxt = File.ReadAllText("data.json");
          JavaScriptSerializer ser = new JavaScriptSerializer();
          // Not sure how to deserialize all lines into List&lt;account&gt;
          List&lt;Account&gt; desirializedAccounts = ser.Deserialize&lt;List&lt;Account&gt;&gt;(JSONtxt);                      
      }
  } 
  </code></pre>
  
  <p>I really appreciate any help you can provide. </p>