title: Convert nested Firebase database object to C# object using Json.NET
body: <p>I need to convert firebase-ish data structure to C# object using JSON.Net library.</p>
  
  <p>I store my data on Firebase Database like following;</p>
  
  <pre class="lang-cs prettyprint-override"><code> {
      "PoolDatas": {
          "-LGGJGTAv_DPtzkmjIbl": {
              "CoinType": 2,
              "PoolType": 4,
              "Alias": "First Alias",
              "Address": "0xAE12EF212",
              "Alarms": {
                  "-LGsdsdv_DPtzkmjIbl": {
                      "Threshold": {
                          "Type": 2,
                          "Val": 100
                      },
                      "AlarmType": 3
                  },
                  "-LBAsdsdv_DPtzkmjIbl": {
                      "Threshold": {
                          "Type": 1,
                          "Val": 1
                      },
                      "AlarmType": 2
                  }
              }
          },
          "-LEAJGTAv_DPtzkmjIbl": {
              "CoinType": 1,
              "PoolType": 1,
              "Alias": "Second Alias",
              "Address": "0xAeeeEF212",
              "Alarms": {
                  "-LGsdsdv_DPtzkmjIbl": {
                      "Threshold": {
                          "Type": 10,
                          "Val": 120
                      },
                      "AlarmType": 1
                  },
                  "-LBAsdsdv_DPtzkmjIbl": {
                      "Threshold": {
                          "Type": 1,
                          "Val": 250
                      },
                      "AlarmType": 2
                  }
              }
          }
      }
   }
  </code></pre>
  
  <p>All list objects have firebase generated ID. I cannot map this data to C# class because firebase IDs don't comply with the list structure. </p>
  
  <p>Please see my model in C# side;</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class PoolData
  {
       public string FirebaseId{ get; set; }
       public string Alias { get; set; }
       public PoolType PoolType { get; set; } //enum
       public CoinType CoinType { get; set; } //enum
       public string Address { get; set; }
       public List&lt;Alarm&gt; Alarms { get; set; }
  }
  
  public class Alarm
  {
       public string FirebaseId{ get; set; }
       public AlarmType AlarmType{ get; set; } //enum
       public Threshold Threshold { get; set; } //object
  }
  
  public class Threshold
  {
       public ThresholdType Type{ get; set; } //enum
       public int Value { get; set; }
  }
  </code></pre>
  
  <p>In order to be able to convert Firebase-ish json into C# object I need a json like this;</p>
  
  <pre class="lang-cs prettyprint-override"><code>{
     "PoolDatas": [
        {
           "FirebaseId": "-LGGJGTAv_DPtzkmjIbl",
           "CoinType": 1,
           "PoolType": 1,
           "Alias": "First Alias",
           "Alarms": [
              {
                 "FirebaseId": "-LGsdsdv_DPtzkmjIbl",
                 "Threshold": {
                    "Type": 1,
                    "Val": 1
                 },
                 "AlarmType": 1
              },
              {
                 "FirebaseId": "-LBAsdsdv_DPtzkmjIbl",
                 "Threshold": {
                    "Type": 1,
                    "Val": 1
                 },
                 "AlarmType": 2
              }
           ],
           "Address": "0xAE12EF212"
        },
        {
           "FirebaseId": "-LEAJGTAv_DPtzkmjIbl",
           "CoinType": 1,
           "PoolType": 1,
           "Alias": "First Alias",
           "Alarms": [
              {
                 "FirebaseId": "-LGsdsdv_DPtzkmjIbl",
                 "Threshold": {
                    "Type": 1,
                    "Val": 1
                 },
                 "AlarmType": 1
              },
              {
                 "FirebaseId": "-LBAsdsdv_DPtzkmjIbl",
                 "Threshold": {
                    "Type": 1,
                    "Val": 1
                 },
                 "AlarmType": 2
              }
           ],
           "Address": "0xAE12EF212"
        }
     ]
  }
  </code></pre>
  
  <p>How can I obtain this json from the first one? </p>
  
  <p>I tried several recursive processes using JObject loops but it didn't work.</p>
  
  <p>Thanks in advance!</p>