What steps will reproduce the problem?
1. Create an Item class with getters and setters.
public class Item { private JsonObject param; }
2. Create a string representation of a json and call it itemList
String itemList = "[{param:{color: 1,shape:1}, {param:{color: 2,shape:2}]";
3. Use gson to convert the itemList into a List<Item>
List<Item> list = gson.fromJson(itemList, new
TypeToken<List<Item>>(){}.getType());
What is the expected output? What do you see instead?
Loop through the list and print out param. It will show {}.
I'm expecting to see
{ color: 1, shape: 1}
{ color: 2, shape: 2}
What version of the product are you using? On what operating system?
Im running gson 2.2.2 on windows 7.
Please provide any additional information below.
To get around this problem, I'm currently using a Map in place of a JsonObject.
Original issue reported on code.google.com by ThaiTra...@gmail.com on 12 Nov 2012 at 1:55
Original issue reported on code.google.com by
ThaiTra...@gmail.com
on 12 Nov 2012 at 1:55