java - Deserializing a field named "class" into a POJO using Jackson -


this may dumb question, deserialize json object pojo myobject field named class, reserved keyword in java... if possible, i'd keep myobject jackson/json/whatever-dependency free.

do need add (standard or jackson-specific) java annotation class field member handle this? or there work-around have "pure" java object? can configure jackson object mapper if needed.

public class myobject {   public string field1;   public string class; // fail } 

since class reserved java keyword, cannot use directly. if want generated json have it, use @jsonproperty , set value attribute.

public class myobject {     public string field1;      @jsonproperty(value = "class")     public string clazz;  } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -