title: Which is the best way to parse JSON data in Android?
body: <p>I have JSON data to parse.  The structure is not fixed, and sometimes it comes as a single string and other times as an array.</p>
  
  <p>Currently, we are using the GSON library for parsing JSON, but are facing problems when it comes as an array.</p>
  
  <p>For example:</p>
  
  <pre><code>1.  {"msg":"data","c":300,"stat":"k"}
  
  
  2. {
      "msg": [
          " {\"id\":2,\"to\":\"83662\",\"from\":\"199878\",\"msg\":\"llll\",\"c\":200,\"ts\":1394536776}"
       ],
       "c": 200,
       "stat": "k",
       "_ts": 1394536776
   }
  </code></pre>
  
  <p>In the example above, sometimes I get msg as a string and sometimes as an array. </p>
  
  <p>Can anyone help me? If I decide to use JSON parsing, it will be very tedious because I have around 20+ API to parse and each API contains a mininum of 50 fields.</p>