title: Correct way of creating a large Json string using Gson
body: <p>I'm using Gson to create a Json string. Up until now, I've been serializing a relatively small classes with a few members, so I just created a class with the needed members and just used <code>toJson</code> to create the json. If it's relevant to this question, then its inside an Android application.</p>
  
  <p>Now I need to create a more complex json with many fields and several levels. An example of the json (at least a part of it just to show the "spirit" of it):</p>
  
  <pre><code>"sleep" : {
    "program" : {
     "appName" : "name",
     "appVersion" : "1.7"
     "serverVersion" : 19
     },
     "userType" : "new",
     "userInfo" : {
        "firstName" : "Hans",
        "lastName" : "Schmidt",
        "city" : "Berlin",
        "country" : "Germany",
      },
     "settings" : {
        "setting1" : "y",
        "setting2" : "none"
   }
   ...
  }
  </code></pre>
  
  <p>In this case, do I need to create a different class for every tree? for example, a class for the "program" part, a class for the "userInfo" and so on and then create a class for the "sleep" root which contains every smaller class as its member and use <code>toJson</code> on it? I'm guessing it will work, but is it the most efficient way to create so many classes for a single Json?</p>