title: json to java pojo with a map via GSON
body: <p>My java pojo looks like this</p>
  
  <pre><code>public class myPersonTO{
    String name;
    String surname;
    Map&lt;String, Double&gt; categories;
  
  }
  </code></pre>
  
  <p>I am using the gson library, however I an not sure what my json stringn, and the object it is created from should like; I am using json stringify, on a javascript object containing two strings and an array of objects, see pseudo code :</p>
  
  <pre><code>var json = [];
  jsonObject = new Object();
  jsonObject.name = "testname"
  jsonObject.surname = "testsurname"
  var categories = [];
  
  for(index=0,index &lt;10;index++){
      var category = new Object();
      category.key = getKey();
      category.value = index;
      categories.push(category);
  }
  jsonObject.categories = categories;
  json.push(jsonObject);
  json = JSON.stringify(json); //convert json object, then use in submit
  </code></pre>
  
  <p>and then in Java I am usign the following :</p>
  
  <pre><code>Type listType = new TypeToken&lt;List&lt;myPersonTO&gt;&gt;() {}.getType();
  List&lt;myPersonTO&gt; myPersonTOList  = new Gson().fromJson(jsonString,listType);
  </code></pre>
  
  <p>Any help gratefully received. Cheers !</p>