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

Popular posts from this blog

c - CUDA code not processing if block properly -

oracle11g - get root domain from url Oracle sql regex_substr -

xcode - Swift Playground - Files are not readable -