Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrays referenced in Object field serialization bug #234

Closed
GoogleCodeExporter opened this issue Mar 19, 2015 · 1 comment
Closed

Arrays referenced in Object field serialization bug #234

GoogleCodeExporter opened this issue Mar 19, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

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

@GoogleCodeExporter
Copy link
Author

Original comment by limpbizkit on 6 Oct 2010 at 6:08

  • Changed state: Duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant