title: Send JSON Object with parameters
body: <p>In my application I am trying to send JSONObject with parameters like UserId, Can anyone please suggest me some tutorials from where I can take some help... </p>
  
  <p>I got this code but in this code I am only able to send the JSONObject not the parameters..</p>
  
  <p>my url is like this: <a href="http://www.example.com/JSONObject/userId" rel="nofollow">http://www.example.com/JSONObject/userId</a></p>
  
  <p>how can i pass the JSONObject with the userId to the server..</p>
  
  <pre><code>public class HTTPPoster {
      public HttpResponse doPost(String url, JSONObject jsonProfilo) throws ClientProtocolException, IOException {
          DefaultHttpClient httpclient = new DefaultHttpClient();
          HttpPost request = new HttpPost(url);
          HttpEntity entity;
          StringEntity s = new StringEntity(jsonProfilo.toString());
          s.setContentEncoding((Header) new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
          entity = s;
          request.setEntity(entity);
          HttpResponse response;
          response = httpclient.execute(request);
          return response;
      }
  }
  </code></pre>
  
  <p>Thanks..</p>