Skip to content

Commit 646f174

Browse files
committed
Cleanup ActiveSupport::JSON
The `quirks_mode` options hasn't been a thing since 9 years ago. As for `max_nesting: false`, it's not a good idea, the default nesting of 100 is plenty and allow to better handle circular dependencies.
1 parent dcbfe09 commit 646f174

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

activesupport/lib/active_support/json/decoding.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class << self
2020
# ActiveSupport::JSON.decode("{\"team\":\"rails\",\"players\":\"36\"}")
2121
# => {"team" => "rails", "players" => "36"}
2222
def decode(json)
23-
data = ::JSON.parse(json, quirks_mode: true)
23+
data = ::JSON.parse(json)
2424

2525
if ActiveSupport.parse_json_times
2626
convert_dates_from(data)

activesupport/lib/active_support/json/encoding.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def jsonify(value)
8989

9090
# Encode a "jsonified" Ruby data structure using the JSON gem
9191
def stringify(jsonified)
92-
::JSON.generate(jsonified, quirks_mode: true, max_nesting: false)
92+
::JSON.generate(jsonified)
9393
end
9494
end
9595

guides/source/upgrading_ruby_on_rails.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2177,7 +2177,7 @@ end
21772177
```irb
21782178
irb> FooBar.new.to_json
21792179
=> "{\"foo\":\"bar\"}"
2180-
irb> JSON.generate(FooBar.new, quirks_mode: true)
2180+
irb> JSON.generate(FooBar.new)
21812181
=> "\"#<FooBar:0x007fa80a481610>\""
21822182
```
21832183

0 commit comments

Comments
 (0)