title: Gson deserialization of List<String> into realmList<RealmString>
body: <p>I'm using retrofit with gson to deserialize my json into realm objects. This works very well for the most part. Trouble arises when dealing with </p>
  
  <blockquote>
    <p>RealmList(String(or any other basic data type))</p>
  </blockquote>
  
  <p>Since Realm doesnt support RealmList where E doesnt extend Realm object, I wrapped String in a RealmObject.</p>
  
  <pre><code>public class RealmString extends RealmObject {
    private String val;
  
    public String getValue() {
      return val;
    }
  
    public void setValue(String value) {
      this.val = value;
    }
  }
  </code></pre>
  
  <p>My realm Object is as below</p>
  
  <pre><code>    public class RealmPerson extends RealmObject {
      @PrimaryKey
      private String userId;
      ...
      private RealmList&lt;RealmString&gt; stringStuff;
      private RealmList&lt;SimpleRealmObj&gt; otherStuff;
  
      &lt;setters and getters&gt;
     }
  </code></pre>
  
  <p>SimpleRealmObj works fine as it only has String elements</p>
  
  <pre><code>    public class SimpleRealmObj extends RealmObject {
      private String foo;
      private String bar;
         ...
      }
  </code></pre>
  
  <p>How can I deserialize stringStuff? I tried using a gson TypeAdapter</p>
  
  <pre><code>public class RealmPersonAdapter extends TypeAdapter&lt;RealmPerson&gt; {
      @Override
      public void write(JsonWriter out, RealmPerson value) throws IOException {
          out.beginObject();
          Log.e("DBG " + value.getLastName(), "");
          out.endObject();
      }
  
      @Override
      public RealmPerson read(JsonReader in) throws IOException {
          QLRealmPerson rList = new RealmPerson();
          in.beginObject();
          while (in.hasNext()) {
              Log.e("DBG " + in.nextString(), "");
          }
          in.endObject();
  
          return rList;
      }
  </code></pre>
  
  <p>However I still hit the IllegalStateException</p>
  
  <blockquote>
    <p>2334-2334/com.qualcomm.qlearn.app E//PersonService.java:71﹕ main com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was NAME at line 1 column 3 path $.</p>
  </blockquote>
  
  <p>I tried RealmList, RealmString adapter earlier to no avail.
  The only workaround I managed to find so far is <a href="https://github.com/realm/realm-java/issues/620#issuecomment-66640786">https://github.com/realm/realm-java/issues/620#issuecomment-66640786</a>
  Any better options?</p>