This question is extension to the question here. I am using the code here reproduced below to GZIP compress a JSONObject.
JSONObject
String foo = \"value\
To inform the server that you are sending gzip-encoded data, send the Content-Encoding header, not Accept-Encoding.