fyhack / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

deserialize map of map #95

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
i'm not sure that it is an issue but i haven't found document that explain
how to execute follow code

Map map = new HashMap();
Map nestedMap = new HashMap();
nestedMap.put("1", "1");
nestedMap.put("2", "2");
map.put("nestedMap", nestedMap);

String json = new Gson().toJson(map);
assertThat(json, is(equalTo("{\"nestedMap\":{\"2\":\"2\",\"1\":\"1\"}}")));

// in next statements i try to deserialize json to obtain same map of map
Map map2 = new Gson().fromJson(json, Map.class);
String json2 = new Gson().toJson(map2);
assertThat(json, is(equalTo(json2)));

Original issue reported on code.google.com by luca.marrocco on 21 Jan 2009 at 12:46

GoogleCodeExporter commented 9 years ago
Added tests for serialization and deserialization of map of maps in r396

The tests pass currently, so we need an exact case that fails before we can 
address it.

Original comment by inder123 on 12 Mar 2009 at 8:54