How to Compress a JSONObject send it over Http in Android?
===

I am sending a `JSONObject` to my Webserver from an `Android client` using the code from [this example][1]. Reproducing code here

    import org.apache.http.HttpResponse;
    import org.apache.http.client.HttpClient;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.apache.http.params.BasicHttpParams;
    import org.apache.http.params.HttpConnectionParams;
    import org.apache.http.params.HttpParams;
    
    int TIMEOUT_MILLISEC = 10000;  // = 10 seconds
    HttpParams httpParams = new BasicHttpParams();
    HttpConnectionParams.setConnectionTimeout(httpParams, TIMEOUT_MILLISEC);
    HttpConnectionParams.setSoTimeout(httpParams, TIMEOUT_MILLISEC);
    HttpClient client = new DefaultHttpClient(httpParams);
    
    HttpPost request = new HttpPost(serverUrl);
    request.setEntity(new ByteArrayEntity(
        postMessage.toString().getBytes("UTF8")));
    HttpResponse response = client.execute(request);

**My Question**

How to do best compression on `JSONObject` before sending it to server and how to decompress it on Server (I am using `Java Servlets`)? 


  [1]: http://stackoverflow.com/questions/3027066/how-to-send-a-json-object-over-request-with-android