title: How to send Hashmap with value with Retrofit
body: <p>I'm trying to send to API through POST an HashMap and an API KEY but I can't, because I need to send it like I do a @Field("something").
  So what i want is @FieldMap("meta")</p>
  
  <p>Example how i use Field: </p>
  
  <pre><code>@FormUrlEncoded
  @POST("/api")
  Call&lt;CallBackMethod&gt; save(@Query("apikey") String api_key,
                            @Field("something") String test);
  </code></pre>
  
  <p>How I currently use FieldMap, but the field map doesn't get send because the API is expecting an Array with a name "meta", so I get an error response from server Metadata does not exist in POST. THE API WORKS.
  But I need to send it an Array with keys and values, that is a Hashmap in Java.</p>
  
  <p>I'm calling this API something like this:</p>
  
  <pre><code>  Map&lt;String, String&gt; meta = new HashMap&lt;&gt;();
          meta.put("user_id", user_id);
          final Api apiService = ApiClient.getAPI().create(Api.class);
          Call&lt;OtherMethod&gt; call = apiService.getOtherMethod(API_KEY, meta);
    call.enqueue(new Callback&lt;OtherMethod&gt;() {
          @Override
          public void onResponse(Call&lt;OtherMethod&gt; call, Response&lt;OtherMethod&gt; response) {
              Log.d("Response Raw", response.raw() + "");
              Log.d("Response Raw", response.isSuccessful() + "");
  
          }
  
          @Override
          public void onFailure(Call&lt;OtherMethod&gt; call, Throwable t) {
              Log.e("E: t.toString());
          }
      });
  </code></pre>
  
  <p>Other class where the methods are:</p>
  
  <pre><code>   @FromUrlEncoded
          @POST("/api")
          Call&lt;OtherMethod&gt; getOtherMethod(@Query("apikey") String api_key,
                                                @FieldMap Map&lt;String, String&gt; meta);
  </code></pre>
  
  <p><strong>EDIT 1:</strong></p>
  
  <p>After some messing around, I managed to get meta to be accepted, but now i have problems with encoding.
  Current API:</p>
  
  <pre><code>   @FormUrlEncoded
      @POST("/api")
      Call&lt;CallBackMethod&gt; getSomething(@Query("apikey") String api_key,
                                    @FieldMap HashMap&lt;String,HashMap&lt;String,String&gt;&gt; meta);
  </code></pre>
  
  <p>This is what it sends:</p>
  
  <pre><code>D/OkHttp: meta=%7Buser_id%3D431%7D
  </code></pre>
  
  <p>I tried with encoding=true and false both the same result.
  This is what it should send</p>
  
  <p><code>meta={user_id=431}</code>
  Does anybody have any idea how to disable encoding?</p>
  
  <p><strong>EDIT 2:</strong>
  I changed the API so i send the @BODY and then json and it works. If anyone has solution for top problem i'll give credit too you. </p>