Skip to content

Not serializing arrays of string #6

Closed

Description

What steps will reproduce the problem?

Try to serialize and array of String

What is the expected output? What do you see instead?

["hello", "world"]
[{},{}]

What version of the product are you using? On what operating system?

Current.  Ubuntu ;)

Please provide any additional information below.

it isn't serializing my array list of strings as it once was, I just get a
list of empty dicts of the same size.

For example the output of :

import com.google.gson.Gson;
import java.util.List;
import java.util.ArrayList;

public class GsonExample {

  public static void main(String args[]) {
    List<String> vals = new ArrayList<String>();
    vals.add("Hello");
    vals.add("World");
    Gson gson = new Gson();
    System.out.println(gson.toJson(vals));
    System.out.println(gson.toJson(vals, List.class));
  }
}

Is :

[{},{}]
[{},{}]

At line 127 of JsonSerializationVisitor the fieldValue of my object is
"ade" for instance and the fieldType is "class java.lang.Object"

At line 131, the childVisitor.getJsonElement() line always returns an empty
dict {}

Regards,

Cameron

Original issue reported on code.google.com by camerong...@gmail.com on 7 May 2008 at 6:21

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions