Monday, 9 September 2019

gson tojson arraylist return null

i found that i got [null] when i was running:

 new Gson().toJson(myobjectlist)

even i added the type:

new Gson().toJson(myobjectlist, listType);

i found that because i created myobjectlist by {{}}

double brace will create inner class which doesn't support serialising....

No comments:

Post a comment