How to parse json with java language keywords -
is there away parse json java keywords class, case, default etc. java object using gson library? lines
gson gson = new gson(); myobject myobject = gson.fromjson(json, myobject.class);
simply parse json pojo, have key "class" in json , can't use field "class" in java classes.
yes, annotate fields @serializedname
, specifying name of field.
@serializedname("class") private string classfield;
or use custom typeadapter
.
Comments
Post a Comment