Converting JSON with inconsistent field names to Java objects with GSON -


i'm using gson convert json file java objects. file contains 2 type of json entities, type 1 pkeycolumn , type 2 named fkeycolumn. here 2 examples:

        "pkeycolumn": {             "pk_blogversions": [                 "blog_id",                 "version_id"             ]         },         "fkeycolumn": [{             "foreignkeycolumns": {                 "blog_id": "id"             },             "referencetable": "blogs"         }], 

i know should make class called pkeycolumn , fkeycolumn, stuck after that. fkeycolumn think make foreignkeycolumns inner class , have single foreignkeycolumn object , referencetable object members of fkeycolumn class. however, problem fields foreignkeycolumns object contains vary object object.

for pkeycolumn, trouble name of array contains varies pkeycolumn pkeycolumn, can't pkeycolumn contains arraylist<string> named pk_blogversions , done it.

any suggestions on how around issue?


Comments