What steps will reproduce the problem?
1. Run the test
public class ComplexObj {
public double[] result;
public Object obj;
}
@Test
public void json_pretty_printing_bug() {
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
ComplexObj response = new ComplexObj();
response.result=new double[2];
response.result[0] = 2.5;
response.result[1] = 2.5;
response.obj=response.result;
assertEquals("{\"result\":[2.5,2.5],\"obj\":[2.5,2.5]}", gson.toJson(response));
}
What is the expected output? What do you see instead?
Expected: {"result":[2.5,2.5],"obj":[2.5,2.5]}
Actual: {"result":[2.5,2.5],"obj":{}}
What version of the product are you using? On what operating system?
1.5
Please provide any additional information below.
This is a regression, i'm switching from gson-1.3 to gson-1.5 as suggested
here: http://code.google.com/p/google-gson/issues/detail?id=233
Original issue reported on code.google.com by gianmarco.gherardi on 12 Sep 2010 at 1:12
Original issue reported on code.google.com by
gianmarco.gherardi
on 12 Sep 2010 at 1:12