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++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

xcode - Swift Playground - Files are not readable -

jboss7.x - JBoss AS 7.3 vs 7.4 and differences -