[
{
"url": "http://www.baidu.com",
"title": "测试1",
"type": 1,
"pic": "null"
},
{
"url": "http://www.baidu.com",
"title": "测试2",
"type": 2,
"pic": "null"
}
]
例如如上的JSON格式,其对应的JavaBean是什么样子的?
[]括号括起来的应该是对应List,但是其List并没有一个key,这该怎么弄?
Gson解析就报这里错了。。。
This is a problem of converting JOSN array to List. For example, the object is as follows
The json string you gave you converted into a list should be:
List<TestBean> list = gson.fromJson(str, new TypeToken<List<TestBean>>(){}.getType());
In json, [] represents an array and {} represents an object. In the above structure, there are two objects in the array, and each object has four properties. The data structure is
http://git.oschina.net/angryi...