title: Reading a JSON file into an object C#
body: <p>I have a JSON list of players for a game. I need the program to be able to read the JSON file and give me the list of players. Then I can use this list of players to get each player's name and who they are following. </p>
  
  <pre><code>{
  "Version": "1",
  "Users": [
   {
    "UserName": "CoolDude",
    "Following": [ "SniperElitez", "IamAwesome" ]
  },
  {
    "UserName": "GamerChick",
    "Following": [ "IamAwesome", "NoWayBro", "WowWhoMe", "SniperElitez", "SurfingIsFun", "NowUTry" ]
  },
  {
    "UserName": "SurfingIsFun",
    "Following": [ "WowWhoMe" ]
  },
  {
    "UserName": "IamAwesome",
    "Following": [ "GamerChick", "NoWayBro" ]
  },
  {
    "UserName": "NowUTry",
    "Following": [ "GamerChick", "SniperElitez" ]
  },
  {
    "UserName": "SniperElitez",
    "Following": [ "SurfingIsFun", "IamAwesome" ]
  },
  {
    "UserName": "WowWhoMe",
    "Following": [ "NoWayBro", "GamerChick", "SniperElitez" ]
  },
  {
    "UserName": "NoWayBro",
    "Following": [ "GamerChick", "IamAwesome", "SniperElitez" ]
  }
  ]
  }
  </code></pre>
  
  <p>Here is the code I'm trying to use currently
  Player Class</p>
  
  <pre><code>class Player
  {
  public string UserName { get; set;}
  public List&lt;string&gt; Following { get; set;}
  }
  </code></pre>
  
  <p>PlayerList Class</p>
  
  <pre><code>class PlayerList
  {
      public List&lt;Player&gt; pList { get; set; }
  
  }
  </code></pre>
  
  <p>Main</p>
  
  <pre><code>{
  
  string json = File.ReadAllText("friends.json");
  // this gives me a playerList object
  PlayerList playerList = JsonConvert.DeserializeObject&lt;PlayerList&gt;(json);
  
      }
  </code></pre>
  
  <p>Supposedly the PlayerList object is not null but the List is empty. If anyone can tell me how to turn the JSON into the PlayerList object and then from there, get player's variables like UserName, I would greatly appreciate it!</p>