title: Deserializing Json Object of objects in C#
body: <p>I've been struggling to get this to work for a while now... So, let's suppose I've got this .json file:</p>
  
  <pre><code>{
      "fieldConfs" : 
          {
              "Object1" : {"origin" : "IdArticulo"    , "destinationTable" : "Articulos", "destinationField" : "IdArticulo", "dataType" : "nvarchar"},
              "Object2" : {"origin" : "Nombre"    , "destinationTable" : "Articulos", "destinationField" : "Descrip", "dataType" : "nvarchar"}
          }
  }
  </code></pre>
  
  <p>And I want to deserialize it into a list of Objects, so each Object inside "fieldConfs" (Object1, object2) will go into a List.</p>
  
  <p>My code so far is:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using Newtonsoft.Json;
  
  namespace modules.dataProcessing.ConfManager
  {
      public class Field
      {
          public string Origin { get; set; }
  
          public string DestinationTable { get; set; }
  
          public string DestinationField { get; set; }
  
          public string DataType { get; set; }
  
      }
  
      public class FieldConfs
      {
          public string Id
          {
              get; set;
          }
  
          public IList&lt;Field&gt; Fields
          {
              get; set;
          }
      }
  
      public static class JsonTools
      {
          public static List&lt;FieldConfs&gt; loadConf(string json)
          {
              List&lt;FieldConfs&gt; fC = new List&lt;FieldConfs&gt;();
              fC = JsonConvert.DeserializeObject&lt;List&lt;FieldConfs&gt;&gt;(json);
              return fC;
          }
      }
  }
  
  </code></pre>
  
  <p>And I call it like this:</p>
  
  <pre><code>List&lt;FieldConfs&gt; confs = new List&lt;FieldConfs&gt;();
  confs = JsonTools.loadConf(json);
  
  </code></pre>
  
  <p>I know I'm lacking something, but I'm new to C# and to Json as well and I don't know what it is that I'm missing. Any hint or help would be appreciate it. Thank you all beforehand.</p>
  
  <p><strong>EDIT:</strong> For a little more clarification, what I'm really asking is for advice on how should I do this, since I'm new.</p>
  
  <p>I'd like to be able to deserialize the json into a list so I can later do in code:</p>
  
  <pre><code>foreach (List&lt;FieldConfs&gt; list in confs) {
  
       // Code for each list where list would be Object1... Object2... 
  }
  </code></pre>
  
  <p>So maybe I'm not structuring well my Json... I don't know if I'm explaining myself well... </p>