title: Deserialize Json from file in C#
body: <h2>I've managed to find a solution without removing the paths from the keys.<br>Thanks for the help guys, and also pointing out problems, I really appreciate it! :)</h2>
  
  <p>Loaded the Json to a string, deserialized it into a dynamic, ran a foreach through it, and added to a List with ResFiles in it.</p>
  
  <pre><code>static void loadJson()
  {
      List&lt;ResFile&gt; fileList = new List&lt;ResFile&gt;();
      string jsonString = File.ReadAllText(jsonPath);
      dynamic files = JsonConvert.DeserializeObject(jsonString);
  
      foreach (var f in files.objects)
          fileList.Add(new ResFile(f.Name, f.Value.hash.ToString(), (int)f.Value.size.Value));
  }
  </code></pre>
  
  <p><br></p>
  
  <hr>
  
  <p><br>
  <strong>I'm trying to deserialize some Json file in C# with Newtonsoft's Json library.</strong><br>
  The files are named after it's hash, not the real file name and I want to rename them back to the proper names, so like this:<br>
  <em>10a54fc66c8f479bb65c8d39c3b62265ac82e742</em> >> <em>file_1.ext</em></p>
  
  <p>The Json file:</p>
  
  <pre><code>{
    "files": {
      "file_1.ext": {
        "hash": "10a54fc66c8f479bb65c8d39c3b62265ac82e742",
        "size": 8112
      },
      "file_2.ext": {
        "hash": "14cfb2f24e7d91dbc22a2a0e3b880d9829320243",
        "size": 7347
      },
      "file_3.ext": {
        "hash": "bf7fadaf64945f6b31c803d086ac6a652aabef9b",
        "size": 3838
      },
      "file_4.ext": {
        "hash": "48f7e1bb098abd36b9760cca27b9d4391a23de26",
        "size": 6905
      }
    }
  }
  </code></pre>
  
  <p>I've tried deserialize with this:</p>
  
  <pre><code>static void loadJson()
  {
      using (StreamReader reader = new StreamReader(jsonPath))
      {
          string json = reader.ReadToEnd();
          dynamic files = JsonConvert.DeserializeObject(json);
      }
  }
  </code></pre>
  
  <p>The deserialization itself working, but I don't know how to loop through them.</p>
  
  <p>I've also tried to do this:</p>
  
  <pre><code>class ResFile
  {
      public string name;
      public string hash;
      public int size;
  }
  </code></pre>
  
  <p>And somehow force the deserialization to use this, but it didn't work of course.</p>