Let people choose their JSON serializer; JSON:API is not circular
This commit is contained in:
parent
e7caa7afd5
commit
b717ffeccf
@ -3,7 +3,6 @@ PATH
|
||||
specs:
|
||||
fast_jsonapi (1.0.17)
|
||||
activesupport (>= 4.2)
|
||||
multi_json (~> 1.12)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
@ -61,7 +60,6 @@ GEM
|
||||
nokogiri (>= 1.5.9)
|
||||
mini_portile2 (2.3.0)
|
||||
minitest (5.10.3)
|
||||
multi_json (1.13.1)
|
||||
nokogiri (1.8.1)
|
||||
mini_portile2 (~> 2.3.0)
|
||||
oj (3.4.0)
|
||||
|
@ -21,7 +21,6 @@ Gem::Specification.new do |gem|
|
||||
gem.summary = "fast JSON API(jsonapi.org) serializer"
|
||||
|
||||
gem.add_runtime_dependency(%q<activesupport>, [">= 4.2"])
|
||||
gem.add_runtime_dependency(%q<multi_json>, ["~> 1.12"])
|
||||
gem.add_development_dependency(%q<activerecord>, [">= 4.2"])
|
||||
gem.add_development_dependency(%q<skylight>, ["~> 1.3"])
|
||||
gem.add_development_dependency(%q<rspec>, ["~> 3.5.0"])
|
||||
|
@ -1,7 +1,6 @@
|
||||
require 'active_support/core_ext/object'
|
||||
require 'active_support/concern'
|
||||
require 'active_support/inflector'
|
||||
require 'multi_json'
|
||||
require 'fast_jsonapi/serialization_core'
|
||||
|
||||
begin
|
||||
|
@ -65,8 +65,9 @@ module FastJsonapi
|
||||
end
|
||||
end
|
||||
|
||||
# Override #to_json for alternative implementation
|
||||
def to_json(payload)
|
||||
MultiJson.dump(payload) if payload.present?
|
||||
JSON.fast_generate(payload) if payload.present?
|
||||
end
|
||||
|
||||
# includes handler
|
||||
|
@ -1,6 +1,5 @@
|
||||
require 'fast_jsonapi'
|
||||
require 'rspec-benchmark'
|
||||
require 'multi_json'
|
||||
require 'byebug'
|
||||
require 'active_model_serializers'
|
||||
require 'oj'
|
||||
|
Loading…
x
Reference in New Issue
Block a user