diff options
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/json/encoders/hash.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/json/encoding.rb | 12 | ||||
-rw-r--r-- | activesupport/lib/active_support/json/variable.rb | 2 |
3 files changed, 1 insertions, 15 deletions
diff --git a/activesupport/lib/active_support/json/encoders/hash.rb b/activesupport/lib/active_support/json/encoders/hash.rb index 3654e10b2e..9a9f074847 100644 --- a/activesupport/lib/active_support/json/encoders/hash.rb +++ b/activesupport/lib/active_support/json/encoders/hash.rb @@ -2,8 +2,6 @@ class Hash def to_json #:nodoc: returning result = '{' do result << map do |key, value| - key = ActiveSupport::JSON::Variable.new(key.to_s) if - ActiveSupport::JSON.can_unquote_identifier?(key) "#{ActiveSupport::JSON.encode(key)}: #{ActiveSupport::JSON.encode(value)}" end * ', ' result << '}' diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb index 64e5779b71..67656109c0 100644 --- a/activesupport/lib/active_support/json/encoding.rb +++ b/activesupport/lib/active_support/json/encoding.rb @@ -10,13 +10,6 @@ end module ActiveSupport module JSON - # When +true+, Hash#to_json will omit quoting string or symbol keys - # if the keys are valid JavaScript identifiers. Note that this is - # technically improper JSON (all object keys must be quoted), so if - # you need strict JSON compliance, set this option to +false+. - mattr_accessor :unquote_hash_key_identifiers - @@unquote_hash_key_identifiers = true - class CircularReferenceError < StandardError end @@ -30,11 +23,6 @@ module ActiveSupport end end - def can_unquote_identifier?(key) #:nodoc: - unquote_hash_key_identifiers && - ActiveSupport::JSON.valid_identifier?(key) - end - protected def raise_on_circular_reference(value) #:nodoc: stack = Thread.current[REFERENCE_STACK_VARIABLE] ||= [] diff --git a/activesupport/lib/active_support/json/variable.rb b/activesupport/lib/active_support/json/variable.rb index 325ac9b7a6..0af98f0968 100644 --- a/activesupport/lib/active_support/json/variable.rb +++ b/activesupport/lib/active_support/json/variable.rb @@ -1,6 +1,6 @@ module ActiveSupport module JSON - # A string that returns itself as as its JSON-encoded form. + # A string that returns itself as its JSON-encoded form. class Variable < String def to_json self |