title: How to convert complex dynamic json to pojo class
body: <p>I have below json </p>
  
  <pre><code>[{
      "Maindata": "{\"SubData\":[{\"Name\":\"a\",\"rollnumber\":1,\"ParentName\":c},{\"Name\":\"b\",\"rollnumber\":2,\"ParentName\":d},{\"Name\":\"m\",\"rollnumber\":3,\"ParentName\":n}],\"schooltime\":123213,\"lunchtime\":2321,\"TeacherName\":\"abc\",\"ClassTeacherName\":\"abc\",\"Subjects\":null,\"ClassName\":\"xyz\",\"PrincipleName\":[\"sdffd\"],\"ClassID\":\"21312\",\"books\":\"\",\"classdata\":{\"scienceclass\":\"2hrs\",\"Projects\":\"True\",\"Games\":\"Nothing\"},\"real\":null,\"classuniqueid\":\"21323234234\",\"schoolbelltime\":21323321}"
  }]
  </code></pre>
  
  <p>In above Json we have </p>
  
  <p>MainData - Main data has two main sections</p>
  
  <pre><code>SubData
  ClassData
  </code></pre>
  
  <p>When i tried to view the above Json viewer it displays MainData as main Json and doesnot display sub data json</p>
  
  <p>Now i want to convert above json to Pojo class, in a way say if i give Name of Subdata as "a" it should give me all details of "a". Now Subdata is dynamic, it has three sections now, it can have 100 when new students data are available or it can have only two. How to write a pojo class which reads this and gives data.</p>
  
  <p>I am using gson and Below is my pojo class</p>
  
  <pre><code>public class MyPojo
  {
      private String Maindata;
  
      public String getMaindata ()
      {
          return Maindata;
      }
  
      public void setMaindata (String Maindata)
      {
          this.Maindata = Maindata;
      }
  
      @Override
      public String toString()
      {
          return "ClassPojo [Maindata = "+Maindata+"]";
      }
  } 
  </code></pre>