rack-jsonp-middleware

Travis CI Status Gemnasium Dependencies Status Code Climate Coverage Status

takes any JSON response and format all the values (but null) to string whenever the proper header value is set.

Overview

Authors

Roberto Decurnex ([email protected])

Contributors

Install

If you are using Bundler you can easily add the following line to your Gemfile:

gem 'rack-json_stringify'

Or you can just install it as a ruby gem by running:

$ gem install rack-json_stringify

Configuration

Rails 3

In your config/application.rb file add:

require 'rack/json_stringify'

And, within the config block:

config.middleware.use Rack::JsonStringify

Rails 2

Same as for Rails 3 but modifying the config/environment.rb file instead.

Rack Apps

In your config.ru file add the following lines:

require 'rack/json_stringify'
use Rack::JsonStringify

Download

You can also clone the project with Git by running: $ git clone git://github.com/robertodecurnex/rack-json_stringify

Examples

Given that http://domain.com/action.json returns:

{"key":1}

Then http://domain.com/action.json with the X-ACCEPTED-TYPES=String will return:

{"key":"1"}