doubled
unread,Mar 16, 2009, 5:43:41 PM3/16/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-gson
Trying out gson and it is working great for most part. Making my Java
code more strongly typed again :)
However one small issue is that the json string I'm trying to convert
to a POJO is containing the string "default". This is a reserved
keyword, so it is not possible to define for example: "private String
default;"
I taught the work around would be something like this:
@SerializedName("default")
private String _default;
However gson doesn't seem to allow that. It seems to check if the
provided name is a valid Java field name. Is there a reason for this
and is there any way around it???
I would have assumed that the main purpose of @SerializedName is to
provide the flexibility to map arbitrary json keys like
("default","int",...) to valid Java field names, but I guess I'm
missing something.
Thanks,
Peter