title: How to deal with dozens of different JSON responses?
body: <p>Throughout my app, I request JSON data from my web server and the response is almost always in a different.</p>
  
  <p>For example, one response might look like this:</p>
  
  <pre><code>{"success":true,"data":{"token_id":"pPt9AKl0Cg","token_key":"8ax224sFrJZZkStAQuER"}}
  </code></pre>
  
  <p>While another might look like this:</p>
  
  <pre><code>{"success":true,"data":{"user_id":"20","username":"Bob"}}
  </code></pre>
  
  <p>And another might look like this:</p>
  
  <pre><code>{"success":true,"data":{"user_id":"20","stats":{"followers":"500","following":"12"}}}
  </code></pre>
  
  <p>Previously, I created a model class (Java) for each different response type. For example, for the first response above, my model class might look like this:</p>
  
  <pre><code>public class MyResponseModel {
          private boolean success;
          private DataModel data;
  
      public static class DataModel {
          private String token_id;
          private String token_key;
      }
  
      ...
  }
  </code></pre>
  
  <p>Is this really the best way of doing this? Because if I do this for the dozen+ responses I get across my app, I'll end up with a dozen+ different model classes, one for each different response.</p>
  
  <p>Are there alternatives to parsing JSON?</p>
  
  <p>Thanks.</p>