title: Gson exception - de-gson a complex object
body: <p>I have an object that contains </p>
  
  <p>public class PositionsChannelApplicationGroups {</p>
  
  <pre><code>public PositionsChannelApplicationGroups(){}
  
      private Map&lt;MyObj1, List&lt;Character&gt;&gt; portfoliosToApplicationIds = new HashMap&lt;MyObj1, List&lt;Character&gt;&gt;();
      private Map&lt;MyObj1, List&lt;Character&gt;&gt; accountsToApplicationIds = new HashMap&lt;MyObj2, List&lt;Character&gt;&gt;();
  
      private Map&lt;Character, List&lt;MyObj1&gt;&gt; applicationIdToPortfolios = new HashMap&lt;Character, List&lt;MyObj1&gt;&gt;();
      private Map&lt;Character, List&lt;MyObj2&gt;&gt; applicationIdToAccounts = new HashMap&lt;Character, List&lt;MyObj2&gt;&gt;();
   }
  </code></pre>
  
  <p>Now I try to gson it at the server and de-gson it  at the client.<br>
  To make it simple I get an exception when I do this in one line </p>
  
  <pre><code> Gson gson = new Gson();
   gson.fromJson(gson.toJson(object), PositionsChannelApplicationGroups.class);
  </code></pre>
  
  <p>or even  </p>
  
  <pre><code> gson.fromJson(gson.toJson(object), new TypeToken&lt;PositionsChannelApplicationGroups&gt;(){}.getType());
  </code></pre>
  
  <p>but it gives me the following exception (below ).<br>
  what am I doing wrong ? </p>
  
  <pre><code>com.google.gson.JsonParseException: Expecting object found: "MyObj1{hibernateID=0, portfolioName='MyString'}"
      at com.google.gson.JsonObjectDeserializationVisitor.visitFieldUsingCustomHandler(JsonObjectDeserializationVisitor.java:100)
      at com.google.gson.ReflectingFieldNavigator.visitFieldsReflectively(ReflectingFieldNavigator.java:63)
      at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:120)
      at com.google.gson.JsonDeserializationContextDefault.fromJsonPrimitive(JsonDeserializationContextDefault.java:85)
      at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:56)
      at com.google.gson.MapTypeAdapter.deserialize(MapTypeAdapter.java:67)
      at com.google.gson.MapTypeAdapter.deserialize(MapTypeAdapter.java:33)
      at com.google.gson.JsonDeserializerExceptionWrapper.deserialize(JsonDeserializerExceptionWrapper.java:51)
      at com.google.gson.JsonDeserializationVisitor.invokeCustomDeserializer(JsonDeserializationVisitor.java:92)
      at com.google.gson.JsonObjectDeserializationVisitor.visitFieldUsingCustomHandler(JsonObjectDeserializationVisitor.java:117)
      at com.google.gson.ReflectingFieldNavigator.visitFieldsReflectively(ReflectingFieldNavigator.java:63)
      at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:120)
  </code></pre>