I’m pleased to report that with GSON 2.0 supports default maps and lists without effort. Deserialize like this:
Object o = new Gson().fromJson(json, Object.class);
The result will be a Map
with String
keys and either String
or Map
values.
Serialize that map back to JSON like this:
String json = new Gson().toJson(o);
We hope to release GSON 2.0 in October 2012. You can get it early from GSON SVN.