title: How Can I Send A JSON Array as Req to URL
body: <p>I'm using the below code for sending the <code>Json</code>array objetc to url.  But, it is not working.</p>
  
  <pre><code>HttpClient httpclient = new DefaultHttpClient();
  
          HttpPost httppost = new HttpPost("urlname");        
  JSONObject json = new JSONObject();
          JSONArray Text_Field_Array = new JSONArray();
          JSONObject json_Text_Field = new JSONObject();
          json_Text_Field.put("pagenum", "1");
          json_Text_Field.put("text", "text field 1");
          json_Text_Field.put("font", "Arial");
          json_Text_Field.put("fontSize", "18");
          json_Text_Field.put("color", "#ff0000");
          json_Text_Field.put("x", "100");
          json_Text_Field.put("y", "0");
          json_Text_Field.put("alignment", "left");
          Text_Field_Array.put(json_Text_Field);
          JSONArray image_Field_Array = new JSONArray();
          JSONObject json_image_Field = new JSONObject();
          json_image_Field.put("image", "http://clintons-test.redboxdigital.net/media/uploads/llll.png");
          json_image_Field.put("pagenum", "1");
          json_image_Field.put("scale", "1");
          json_image_Field.put("rotation", "90");
          json_image_Field.put("x", "100");
          json_image_Field.put("y", "10");
          json_image_Field.put("width", "100");
          json_image_Field.put("height", "100");
          image_Field_Array.put(json_image_Field);
          json.put("images", image_Field_Array);
          json.put("all_text_fields", Text_Field_Array);
          json.put("sku", "CCI1022537");
  
  StringEntity se = new StringEntity( "JSON: " + json.toString());  
          se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
  
          httppost.setEntity(se);
  
  
          Log.v("URI","==="+ httppost);
  
          HttpResponse response = httpclient.execute(httppost);
          InputStream is = response.getEntity().getContent();
          SAXParserFactory spf = SAXParserFactory.newInstance();
          SAXParser sp = spf.newSAXParser();
          XMLReader xr = sp.getXMLReader();
  
  
          sb = new StringBuilder();
          byte[] buffer = new byte[512];
          int bytes_read = 0;
  
          while((bytes_read = is.read(buffer, 0, buffer.length)) &gt; 0)
          {
              sb.append( new String(buffer,0,bytes_read));
          }
  </code></pre>
  
  <p>I used the above code by considering the primalpop's answer in <a href="https://stackoverflow.com/questions/3027066/how-to-send-a-json-object-over-request-with-android">sending Json as req to url</a>
  I think the problem is:</p>
  
  <pre><code>StringEntity se = new StringEntity( "JSON: " + json.toString());  
              se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
  
              httppost.setEntity(se);
  </code></pre>
  
  <p>Any one have idea on how we send the Json array to url, give me some suggestions.  Thanks in advance</p>