title: Passing Realm object as Retrofit 2 PUT request body
body: <p>I am trying to use RealmObject as a PUT message body content in Retrofit 2. I have implemented custom Gson with JsonSerializer and it works fine outside of Retrofit, but I am still not getting object data in request body. <br/>
  Gradle build for retrofit and gson:<br/></p>
  
  <pre><code>compile 'com.google.code.gson:gson:2.6.2'
  compile 'com.squareup.retrofit2:retrofit:2.1.0'
  compile 'com.squareup.retrofit2:converter-gson:2.1.0'
  </code></pre>
  
  <p>Retrofit service:</p>
  
  <pre><code>public interface LogstashRetrofitService {
      @PUT(LOGSTASH_SERVER_PATH)
      Call&lt;ResponseBody&gt; putLogstashMessage(@Body LogstashMessage logstashMessage);
  }
  </code></pre>
  
  <p><br/>Building Retrofit:
  <br/></p>
  
  <pre><code>Retrofit retrofit = new Retrofit.Builder()
              .baseUrl(LOGSTASH_SERVER_HOST)
              .addConverterFactory(GsonConverterFactory.create(RealmObjectGsonBuilder.getRealmGson()))
              .client(httpClient.build())
              .build();
  logstashRetrofitService = retrofit.create(LogstashRetrofitService.class);
  logstashRetrofitService.putLogstashMessage(logstashMessage).enqueue(new Callback&lt;ResponseBody&gt;() {
          @Override
          public void onResponse(Call&lt;ResponseBody&gt; call, Response&lt;ResponseBody&gt; response) {}
          @Override
          public void onFailure(Call&lt;ResponseBody&gt; call, Throwable t) {}
      });
  </code></pre>