Skip to content Skip to sidebar Skip to footer

How To Compress JSON With Gzip In Rails For Android?

I am running Rails 3.2.7 with Ruby 1.9.3p194 to output JSON data from an SQLite database. render :json => result.to_json An Android application consumes the JSON file which ge

Solution 1:

maybe you should use Rack::Deflater? insert in config.ru:

require ::File.expand_path('../config/environment',  __FILE__)
use Rack::Deflater
run MyAppName::Application

and configure your http request headers:

I can configure the header of a HTTP request:

httpPost.setHeader("Accept-Encoding", "gzip");

P.S. the same configuration works on Heroku


Post a Comment for "How To Compress JSON With Gzip In Rails For Android?"