Comment #8 on issue 501 by
shiv...@totvslabs.com: Gson fails to parse
simple map
https://code.google.com/p/google-gson/issues/detail?id=501
@Maaarti: I guess I didn't provide the full information. The real object
that we convert back from json is:
Map<String, List<Map<PassingParamEnum, Object>>>. And what we use to
convert it is:
Type mapType = new TypeToken<HashMap<String, List<Map<PassingParamEnum,
Object>>>>()
{
}.getType();
actualObject = gson.fromJson(theJsonString, mapType);
I am not using a map as a key. I am using a String as a key. I also have a
LIST of a Map which is really where gson is giving us errors for Duplicate
Keys.
com.google.gson.JsonSyntaxException: duplicate key: PENDING_ACTION_ID
the PENDING_ACTION_ID is actually a key for this map: Map<PassingParamEnum,
Object> and then a list of that Map is stored.
The weird thing is it doesn't happen all the times. Once a while it starts
giving this error. And in the json string itself if you move around the
key, it suddenly works.
I am willing to provide the json string data where it SOMETIMES fails if
anyone is interested in looking at it.