Skip to content

Commit

Permalink
Revert "Merge pull request #50489 from maniSHarma7575/50481-fix-activ…
Browse files Browse the repository at this point in the history
…esupport-json-encode"

This reverts commit 7b9e9ee, reversing
changes made to 590a675.

Reason: #50489 (comment)
  • Loading branch information
rafaelfranca committed May 22, 2024
1 parent 26f8edf commit c0a2b28
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
8 changes: 1 addition & 7 deletions activesupport/lib/active_support/json/encoding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,7 @@ def jsonify(value)
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
Expand Down
3 changes: 1 addition & 2 deletions activesupport/test/json/encoding_test_cases.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ module EncodingTestCases
[ [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")],
Expand Down

0 comments on commit c0a2b28

Please sign in to comment.