What steps will reproduce the problem?
public class GsonTest {
private static class TestType {
Map<String, String> map = new TreeMap<String, String>();
}
/**
* @param args
*/
public static void main(String[] args) {
TestType t = new TestType();
t.map.put("name1", null);
t.map.put("name2", "value2");
Gson gson = new Gson();
System.out.println(gson.toJson(t));
}
}
The output is:
{"map":{,"name2":"value2"}}
Note the extra comma at the beginning of the map.
The expected output is:
{"map":{"name2":"value2"}}
What version of the product are you using? On what operating system?
This is gson 1.2.3 on Ubuntu 8.10 64-bit.
Original issue reported on code.google.com by gary...@gmail.com on 8 Feb 2009 at 6:55
Original issue reported on code.google.com by
gary...@gmail.com
on 8 Feb 2009 at 6:55