aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/json/decoding.rb
diff options
context:
space:
mode:
authorGodfrey Chan <godfreykfc@gmail.com>2013-09-12 09:58:18 -0700
committerGodfrey Chan <godfreykfc@gmail.com>2013-09-12 09:58:18 -0700
commit52fb1a9565a2c1d163efa95f3d1a42247a4cc074 (patch)
treea52d6b24e0a2cd16e78ef63a45e138a4ce7ee878 /activesupport/lib/active_support/json/decoding.rb
parent4bdf929579cf80713518cc12b4610dd3ae7a9adf (diff)
downloadrails-52fb1a9565a2c1d163efa95f3d1a42247a4cc074.tar.gz
rails-52fb1a9565a2c1d163efa95f3d1a42247a4cc074.tar.bz2
rails-52fb1a9565a2c1d163efa95f3d1a42247a4cc074.zip
Enabled quirks mode on JSON.parse, fixes broken test in af9caae
It turns out that ActionPack depends on the decoder to parse JSON "fragments" (e.g. '"a string"', '1', 'null', etc), so we need to enable quirks mode on JSON.parse. Also added coverage on the decoder side to prevent regression.
Diffstat (limited to 'activesupport/lib/active_support/json/decoding.rb')
-rw-r--r--activesupport/lib/active_support/json/decoding.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/json/decoding.rb b/activesupport/lib/active_support/json/decoding.rb
index 2533ff43e1..21de09c1cc 100644
--- a/activesupport/lib/active_support/json/decoding.rb
+++ b/activesupport/lib/active_support/json/decoding.rb
@@ -14,7 +14,7 @@ module ActiveSupport
# ActiveSupport::JSON.decode("{\"team\":\"rails\",\"players\":\"36\"}")
# => {"team" => "rails", "players" => "36"}
def decode(json, options = {})
- data = ::JSON.parse(json, options.merge(create_additions: false))
+ data = ::JSON.parse(json, options.merge(create_additions: false, quirks_mode: true))
if ActiveSupport.parse_json_times
convert_dates_from(data)
else