title: Retrieve data from firebase database to nested dictionary
body: <p>I'm having a lots of problems trying to retrieve data from the firebase database and moving that data to a unity dictionary.</p>
  
  <p>So I would like to do this, to just retrieve the data one time and then place all the data to a dictionary, the problem is that I can't find the way to do it if the dictionary is a nested dictionary.</p>
  
  <p>This is how my database looks like (simplified):</p>
  
  <pre><code>    {"questions": {
      "group1": {
          "id_1": {
            "Question": "question one",
            "A": "answer1"
          },
          "id_2": {
            "Question": "question two",
            "A": "answer2"
          }
        }
    }
      }
  </code></pre>
  
  <p>So in my code I do the following:</p>
  
  <pre><code>public void RetrievePreguntesJson()
  {
      string group = "group1"
      questions_ref.Child(group).GetValueAsync().ContinueWith(task =&gt; {
          if (task.IsFaulted)
          {
              Debug.LogError("Error Getting Info from user database");
          }
          else if (task.IsCompleted)
          {
              DataSnapshot snapshot = task.Result;
              myDictionary = snapshot.Value as Dictionary&lt;string, object&gt;;
              dataReady();
          }
      });
  }
  </code></pre>
  
  <p>So the problem is that I can't get any value.
  I would like to do something like <code>myDictionary["id_1"]["Question"]</code> and get the value "question one". Or <code>myDictionary["id_1"].Question</code> and get the value "question one".</p>
  
  <p>I already tried the following:
  - Create a Class questions like this:</p>
  
  <pre><code>public class Questions
  {
      public string id;
      public string Question;
      public string Answer;
  
      public Questions(string id, string Question, string Answer)
      {
          this.id = id;
          this.Question = Question;
          this.Answer = Answer;
      }
  }
  </code></pre>
  
  <p>And use the following code instead of <code>"userInfoDictionary = snapshot.Value as Dictionary&lt;string, object&gt;;"</code></p>
  
  <p>Use:</p>
  
  <pre><code>Questions ClassObjectName = JsonUtility.FromJson&lt;Questions&gt;(snapshot.GetRawJsonValue());
  </code></pre>
  
  <p>But it didn't work either.</p>
  
  <p>Also tried:</p>
  
  <pre><code>"userInfoDictionary = snapshot.Value as Dictionary&lt;string, Dictionary&lt;string, object&gt;&gt;;"
  </code></pre>
  
  <p>But it won't work either.</p>
  
  <p>Can anyone help me please?</p>
  
  <p>"EDIT"</p>
  
  <p>This is my json:</p>
  
  <pre><code>{"questions": {
      "group1": {
          "id_1": {
            "Question": "question one",
            "A": "answer1"
          },
          "id_2": {
            "Question": "question two",
            "A": "answer2"
          }
        }
    }
      }
  </code></pre>
  
  <p>And this are the objects:</p>
  
  <pre><code>[System.Serializable]
  public class Group1
  {
      public QuestionsId group1;
  }
  [System.Serializable]
  public class QuestionsId
  {
      public Questions id;
  }
  [System.Serializable]
  public class Questions
  {
      public string Question;
      public string A;
  }
  </code></pre>
  
  <p>I'm deserializing the Json with:</p>
  
  <pre><code>Group1 ClassObjectName = JsonUtility.FromJson&lt;Group1&gt;(snapshot.GetRawJsonValue());
  </code></pre>
  
  <p>I would like to be able to have a result calling the values like this:
  <code>myDictionary["id_1"].Question</code>
  <code>myDictionary["id_1"]["Question"]</code></p>
  
  <p>I'm using the object and the Json utility now, but if there is anyway to use a unity dictionary to have the result that I would like to have it is also ok for me. For example: <code>"userInfoDictionary = snapshot.Value as Dictionary&lt;string, object&gt;;"</code></p>
  
  <p>Does anyone knows how to help me please?</p>