Gson ignore null when deserializing object
问题 I want to deserialize a json string that containts a null value in Java. I want to deserialize the object to a Properties object. The json string is something like: {"prop1":null, "propr2":"fancy value"} When I deserialize using String json = // new Gson().fromJson(json, Properties.class); I get a null pointer exception because of the Hastable that into the Properties object. How can I instruct Gson to ignore deserialization of null values? 回答1: We have this solution: 1. All of your data