android - Deserialise JSON with dynamic field -


i'm loading json dynamic field api using retrofit on android.

this example:

{     "success": true,     "messages": {         "success": [             "success_message"         ],         "error": {             "specific_error": {                 …             }         }     },     "session": {         "id": "fj4qewqrewq43fdsa",         "expire": null,         "yii_csrf_token": "fda432fdafasd78978fdas"     },     "metadata": {…} } 

the structure of messages object can change every request. there success field , not. same goes error field. error field can array object several other objects , fields inside.

does make sense deserialise messages field different pojos , if how that? make more sense keep field json object , values object when needed?


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -