title: How to Send JsonArray From Client(java or Android ) To servlet(Server)
body: <p>i have to send This JsonArray With HTTP Request from client to sever and have to fetch it on to servlet page..without NameValuePair Class because my requirement is diffrent.</p>
  
  <p>any help would be appreciated.</p>
  
  <p>hear is some code i was using to send parameters but this time its jsonArray so i cant use it</p>
  
  <pre><code>   Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
     params.put(Constants.NAME, name);
  </code></pre>
  
  <p>and then building the body.</p>
  
  <pre><code> StringBuilder bodyBuilder = new StringBuilder();
  Iterator&lt;Entry&lt;String, String&gt;&gt; iterator = params.entrySet().iterator();
  // constructs the POST body using the parameters
  while (iterator.hasNext()) {
      Entry&lt;String, String&gt; param = iterator.next();
      bodyBuilder.append(param.getKey()).append('=')
              .append(param.getValue());
      if (iterator.hasNext()) {
          bodyBuilder.append('&amp;');
      }
  }
  String body = bodyBuilder.toString();
  </code></pre>
  
  <p>and then HTTP Request.</p>
  
  <pre><code> conn = (HttpURLConnection)url.openConnection();
          conn.setDoOutput(true);
          conn.setUseCaches(false);
          conn.setFixedLengthStreamingMode(bytes.length);
          conn.setRequestMethod("POST");
          conn.setRequestProperty("Content-Type",
                  "application/x-www-forurlencoded;charset=UTF-8");
          // post the request
          OutputStream out = conn.getOutputStream();
  
          out.write(bytes);
  </code></pre>