title: Fail to parse Dynamic KeyValue pair JSON Using Custom JsonDeserializer GSON
body: <p>I am tried to parse JSON using customDeserilizer for nesting Object</p>
  
  <p>Here is my deserializer: </p>
  
  <pre><code>    class MapDeserializer implements JsonDeserializer&lt;Map&lt;String, String&gt;&gt; {
  
      public Map&lt;String, String&gt; deserialize(JsonElement json, Type typeOfT,
                                             JsonDeserializationContext  context){
          try {
          Map&lt;String, String&gt; result = new HashMap&lt;String, String&gt;();
          JsonObject object = json.getAsJsonObject(); 
              for (Map.Entry&lt;String, JsonElement&gt; entry : object.entrySet()) {
                  String key = entry.getKey();
                  String value = entry.getValue().getAsString();
                  result.put(key, value);
              }
      //    }
              return result;
          }catch (Exception e){
              e.printStackTrace();
              return null;
          }
      }
  }  
  </code></pre>
  
  <p>And i am using following line of code to register this deserializer</p>
  
  <pre><code>      Gson gson = new           GsonBuilder().registerTypeHierarchyAdapter(TaggedActorMap.class, new MapDeserializer()).create();
                      sActivityBean = gson.fromJson(result,
                              SimilarActivityBean.class);
  </code></pre>
  
  <p>Here is my POJO Class</p>
  
  <pre><code>public class TaggedActorMap implements Serializable {
  private String key;
  private  String value;
    }
  </code></pre>
  
  <p>I am getting following Error</p>
  
  <pre><code>    java.lang.IllegalArgumentException: invalid value for field
    at java.lang.reflect.Field.setField(Native Method)
    at java.lang.reflect.Field.set(Field.java:588)
    at     com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1
    .read(ReflectiveTypeAdapterFactory.java:119)
    at   com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter
    .read(ReflectiveTypeAdapterFactory.java:217)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.
    read(TypeAdapterRuntimeTypeWrapper.java:40)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.
    read(CollectionTypeAdapterFactory.java:81)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.
    read(CollectionTypeAdapterFactory.java:60)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.
    read(ReflectiveTypeAdapterFactory.java:117)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.
    read(ReflectiveTypeAdapterFactory.java:217)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.
    read(ReflectiveTypeAdapterFactory.java:117)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter
   .read(ReflectiveTypeAdapterFactory.java:217)
    at com.google.gson.Gson.fromJson(Gson.java:814)
    at com.google.gson.Gson.fromJson(Gson.java:779)
    at com.google.gson.Gson.fromJson(Gson.java:728)
    at com.google.gson.Gson.fromJson(Gson.java:700)
  </code></pre>