title: How to pass complex parameter to POST request using Apache HTTP client?
body: <p>I attempt to send <code>POST</code> request with body like this</p>
  
  <pre><code>{
    "method": "getAreas",
    "methodProperties": {
        "prop1" : "value1",
        "prop2" : "value2",
     }
  }
  </code></pre>
  
  <p>Here is my code</p>
  
  <pre><code>static final String HOST = "https://somehost.com";
  
    public String sendPost(String method,
        Map&lt;String, String&gt; methodProperties) throws ClientProtocolException, IOException {
  
      HttpPost post = new HttpPost(HOST);
  
      List&lt;NameValuePair&gt; urlParameters = new ArrayList&lt;&gt;();
      urlParameters.add(new BasicNameValuePair("method", method));
  
      List&lt;NameValuePair&gt; methodPropertiesList = methodProperties.entrySet().stream()
                  .map(entry -&gt; new BasicNameValuePair(entry.getKey(), entry.getValue()))
                  .collect(Collectors.toList());
  
      // ??? urlParameters.add(new BasicNameValuePair("methodProperties", methodPropertiesList));
  
      post.setEntity(new UrlEncodedFormEntity(urlParameters));
  
      try (CloseableHttpClient httpClient = HttpClients.createDefault();
          CloseableHttpResponse response = httpClient.execute(post)) {
  
        return EntityUtils.toString(response.getEntity());
      }
    }
  </code></pre>
  
  <p>But constructor of <code>BasicNameValuePair</code> applies <code>(String, String)</code>. So I need another class instead. </p>
  
  <p>Is there any way to add <code>methodPropertiesList</code> to <code>urlParameters</code>?</p>