title: Gson deserialize json with varying value types
body: <p>I'm trying to deserialize a <code>JSONArray</code> with Gson, one the values' type can vary, the value "in_wanted" can be either a <code>boolean</code> or a <code>JSONObject</code>.</p>
  
  <p>in_wanted as <code>boolean</code>:</p>
  
  <pre><code>{
  "movies": [
          {
              "title": "example boolean",
              "in_wanted": false
          }
      ]           
  }
  </code></pre>
  
  <p>in_wanted as <code>JSONObject</code>:</p>
  
  <pre><code>{
  "movies": [
          {
              "title": "example object",
              "in_wanted": {
                  "profile": {
                      "value": false
                  }
              }
          }
      ]           
  }
  </code></pre>
  
  <p>I need the object whenever it's available and i need a deserializer to return null whenever the value of "in_wanted" is a boolean. What would be the best way to do this with Gson?</p>