java - How to convert string array to object using GSON/ JSON? -


i have json this:

[   [     "passport number",     "nationality",     "reasons"   ],   [     "shais100",     "india",     ""   ],   [     "",     "",     "agent id not matched."   ],   [     "",     "",     ""   ] ] 

i want populate arraylist<string[]>,please tell me how do?

and empty strings should not convert null.

that's simple, need following:

1.- first create gson object:

gson gson = new gson(); 

2.- correspondent type list<string[]> (note can't list<string[]>.class due java's type erasure):

type type = new typetoken<list<string[]>>() {}.gettype(); 

3.- parse json structure of type type:

list<string[]> yourlist = gson.fromjson(yourjsonstring, type); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -