Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use OJ for JSON serialization #259

Merged
merged 2 commits into from
Dec 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ gem 'rack-cors', require: 'rack/cors'
# providing API
gem 'active_model_serializers', '0.9.3'
gem 'oj'
gem 'oj_mimic_json'

# consuming other APIs
gem 'faraday'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ GEM
nokogiri (1.6.7.1)
mini_portile2 (~> 2.0.0.rc2)
oj (2.14.1)
oj_mimic_json (1.0.1)
pg (0.18.4)
pghero (1.1.4)
activerecord
Expand Down Expand Up @@ -382,6 +383,7 @@ DEPENDENCIES
marginalia
mock_redis
oj
oj_mimic_json
pg
pghero
pry-byebug
Expand Down
7 changes: 7 additions & 0 deletions config/initializers/oj.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Oj: a fast JSON parser and Object marshaller as a Ruby gem
# https://github.com/ohler55/oj#options

Oj.default_options = {
bigdecimal_load: :auto,
float_precision: 0 # use Ruby
}