title: Using gson to deserialize specific JSON field of an object
body: <p>I have the following JSON string:</p>
  
  <pre><code>{
      "ms": "images,5160.1",
      "turl": "http://ts1.mm.bing.net/th?id=I4693880201938488&amp;pid=1.1",
      "height": "178",
      "width": "300",
      "imgurl": "http://www.attackingsoccer.com/wp-content/uploads/2011/07/World-Cup-2012-Draw.jpg",
      "offset": "0",
      "t": "World Cup 2014 Qualification – Europe Draw World Cup 2012 Draw ...",
      "w": "719",
      "h": "427",
      "ff": "jpeg",
      "fs": "52",
      "durl": "www.attackingsoccer.com/2011/07/world-cup-2012-qualification-europe...",
      "surl": "http://www.attackingsoccer.com/2011/07/world-cup-2012-qualification-europe-draw/world-cup-2012-draw/",
      "mid": "D9E91A0BA6F9E4C65C82452E2A5604BAC8744F1B",
      "k": "6",
      "ns": "API.images"
  }
  </code></pre>
  
  <p>I need to store the value of <code>imgurl</code> in a separate string.</p>
  
  <p>This is what I have till now, but this just gives me the whole JSON string instead of the specific imgurl field.</p>
  
  <pre><code>Gson gson = new Gson();
  Data data = new Data();
  data = gson.fromJson(toExtract, Data.class);
  System.out.println(data);
  </code></pre>
  
  <p><code>toExtract</code> is the JSON string. 
  Here is my data class:</p>
  
  <pre><code>public class Data 
  {
      public List&lt;urlString&gt; myurls;
  }
  
  class urlString
  {
      String imgurl;
  }
  </code></pre>