title: Gson - Same field name, different types
body: <p>I asked this in a different question today but I'm afraid that won't get any solution because of how it was phrased.</p>
  
  <p>I have a json input that has the following data:</p>
  
  <p><img src="https://i.stack.imgur.com/e4HJV.jpg" alt="Json"></p>
  
  <p>As you can see, the <strong>option_value</strong> item is an Array in one object and a simple string in another object.</p>
  
  <p>How can I make Gson handle this properly? My class has this described as a List object, so it works for the first few items where <strong>option_value</strong> is an array, but when it becomes a <em>string</em>, the app crashes and I get a <strong>json parse exception</strong>.</p>
  
  <p>Is there a workaround for this?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Adding the relevant part of my class as requested:</p>
  
  <pre><code>public class Options
      {
          String product_option_id;
          String option_id;
          String name;
          String type;
          String required;
          List&lt;OptionValue&gt; option_value;
  
          // get set stuff here
  
          public class OptionValue
          {
              String product_option_value_id;
              String option_value_id;
              String name;
              String image;
              String price;
              String price_prefix;
  
              // get set stuff here
          }
      }
  </code></pre>