Suppose i have some class like this one:
TreeNode {
int id;
TreeNode parent;
List<TreeNode> children;
String nodeName;
String nodeValue;
}
I want to be able to get following JSON:
{"id":<id>, "parent":<parent id>, "nodeName":<name>, "nodeValue":<value>,
"children":[<child
1 id>, <child 2 id>...]}
Using serializer like this one:
public JsonElement serialize(TreeNode src, Type typeOfSrc, JsonSerializationContext context) {
return new JsonPrimitive(src.getId());
}
For all objects except root one will solve this problem
Original issue reported on code.google.com by zlow...@gmail.com on 20 Nov 2009 at 3:48
Original issue reported on code.google.com by
zlow...@gmail.com
on 20 Nov 2009 at 3:48