Revert "Merge pull request #50489 from maniSHarma7575/50481-fix-activesupport-json-encode"

This reverts commit 7b9e9ee244, reversing
changes made to 590a675c4e.

Reason: https://github.com/rails/rails/pull/50489#issuecomment-2123881327
This commit is contained in:
Rafael Mendonça França 2024-05-22 18:13:23 +00:00
parent 26f8edf411
commit c0a2b28038
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
2 changed files with 2 additions and 9 deletions

View File

@ -76,13 +76,7 @@ module ActiveSupport
when Hash
result = {}
value.each do |k, v|
unless String === k
k = if Symbol === k
k.name
else
k.to_s
end
end
k = k.to_s unless Symbol === k || String === k
result[k] = jsonify(v)
end
result

View File

@ -81,8 +81,7 @@ module JSONTest
[ [1, "a", :b, nil, false], %([1,\"a\",\"b\",null,false]) ]]
HashTests = [[ { foo: "bar" }, %({\"foo\":\"bar\"}) ],
[ { 1 => 1, 2 => "a", 3 => :b, 4 => nil, 5 => false }, %({\"1\":1,\"2\":\"a\",\"3\":\"b\",\"4\":null,\"5\":false}) ],
[ { "a" => 1, :a => 2, :c => { "b" => 3, :b => 4 } }, %({\"a\":2,\"c\":{\"b\":4}}) ]]
[ { 1 => 1, 2 => "a", 3 => :b, 4 => nil, 5 => false }, %({\"1\":1,\"2\":\"a\",\"3\":\"b\",\"4\":null,\"5\":false}) ]]
RangeTests = [[ 1..2, %("1..2")],
[ 1...2, %("1...2")],