title: Pass Java Object into Retrofit not processing correctly
body: <p>I am trying to upload an array of files, an authorization header, and a java object.</p>
  
  <p>The issue is the way the backend is setup, I do not want to name the @Part annotation for my DocumentUpdateObject. Is there a way to allow for @Part(null), or to convert my custom object (DocumentUpdateObject) into a MultipartBody.Part? I'll post some examples to explain better.</p>
  
  <p>The array of files is technically optional, so this statement below works perfectly.</p>
  
  <pre><code>@PUT("document/")
  Call&lt;ResponseBody&gt; updateDocument(
          @Header("Authorization") String token,
          @Body DocumentUpdateObject object);
  </code></pre>
  
  <p>What I would like to have functional is something similar to this:</p>
  
  <pre><code>@Multipart
  @PUT("document/")
  Call&lt;ResponseBody&gt; updateDocumentDocs(
          @Header("Authorization") String token,
          @Part DocumentUpdateObject object,
          @Part ArrayList&lt;MultipartBody.Part&gt; files);
  </code></pre>
  
  <p>In regards to the second parameter, if I do not give @Part a name, <code>@Part("object")</code>, then it fails. If I give @Part a name then the backend is unable to read it properly. I wants to read it similar to @Body above.</p>
  
  <p>Is there code for converting an object to a MultipartBody.Part (if that would solve it)? I've seen a couple solutions but they seem to only work for simple single String requests. My DocumentUpdateObject has 5 variable parameters including another object with 5 more variable parameters. I have considered MultipartBody.Builder, but it doesn't appear to handle nested objects.</p>
  
  <p>Edit: This is all read expecting a JSON format</p>
  
  <p>Edit 2:
  Basically I was able to get part of the object to send by breaking it apart, but the final object inside of it I have been unable to process properly.</p>
  
  <pre><code>//These request bodies send properly
  RequestBody defncynbrBody =
              RequestBody.create(deficiencyNbr, MediaType.parse("application/json"));
  RequestBody assetBody =
              RequestBody.create(assetnbr, MediaType.parse("application/json"));
  RequestBody subassetBody =
              RequestBody.create(subassetnbr, MediaType.parse("application/json"));
  
  //This object down here still is unable to be recieved properly
  Gson gson = new Gson();
  String json = gson.toJson(add);
  RequestBody addBody =
              RequestBody.create(json, MediaType.parse("application/json"));
  </code></pre>
  
  <p><strong>Edit 3</strong></p>
  
  <p>This does not properly work  </p>
  
  <pre><code>   Content-Disposition: form-data; name="defncy"
      2019-09-25 10:20:24.123 D/OkHttp: Content-Transfer-Encoding: binary
      2019-09-25 10:20:24.123 D/OkHttp: Content-Type: application/json; charset=utf-8
      2019-09-25 10:20:24.123 D/OkHttp: {"defncytyp":"LOW","descr":"details are here this",
      "duedate":"2019-09-23","maintlogcattyp":"INTR","title":"Newest one"}
  </code></pre>
  
  <p>Yet this one works great.</p>
  
  <pre><code>2019-09-25 10:31:58.404 D/OkHttp: Content-Type: application/json; charset=UTF-8
  2019-09-25 10:31:58.405 D/OkHttp: {"defncy":{"defncytyp":"LOW","descr":"details are here this",
  "duedate":"2019-09-23","maintlogcattyp":"INTR","title":"Newest on"},"assetnbr":4,"defncynbr":18,"subassetnbr":0,"usrs_assigned":0}
  </code></pre>