You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
unable to serialize an object with list of other objects #170
interface IPerson {
String getName();
}
public class Person implements IPerson {
private String name;
public Person() {
}
public Person(String name) {
this.name = name;
}
@Override
public String getName() {
return name;
}
}
public class People {
private List<IPerson> people = new LinkedList<IPerson>();
public People() {
}
public People(List<IPerson> people) {
this.people = people;
}
public List<IPerson> getPeople() {
return people;
}
}
@Test
public void testGsonProjects() {
People people = new People(asList((IPerson) new Person("Obama")));
String json = new Gson().toJson(people);
System.out.println(json);
}
expected: {people:[{name:"Obama"}]}
actual : {people:[{}]}
affected version: 1.3, 1.4
Original issue reported on code.google.com by luca.marrocco on 30 Oct 2009 at 11:33
Activity