Skip to content

Commit c0a2b28

Browse files
committed
Revert "Merge pull request rails#50489 from maniSHarma7575/50481-fix-activesupport-json-encode"
This reverts commit 7b9e9ee, reversing changes made to 590a675. Reason: rails#50489 (comment)
1 parent 26f8edf commit c0a2b28

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

activesupport/lib/active_support/json/encoding.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,7 @@ def jsonify(value)
7676
when Hash
7777
result = {}
7878
value.each do |k, v|
79-
unless String === k
80-
k = if Symbol === k
81-
k.name
82-
else
83-
k.to_s
84-
end
85-
end
79+
k = k.to_s unless Symbol === k || String === k
8680
result[k] = jsonify(v)
8781
end
8882
result

activesupport/test/json/encoding_test_cases.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ module EncodingTestCases
8181
[ [1, "a", :b, nil, false], %([1,\"a\",\"b\",null,false]) ]]
8282

8383
HashTests = [[ { foo: "bar" }, %({\"foo\":\"bar\"}) ],
84-
[ { 1 => 1, 2 => "a", 3 => :b, 4 => nil, 5 => false }, %({\"1\":1,\"2\":\"a\",\"3\":\"b\",\"4\":null,\"5\":false}) ],
85-
[ { "a" => 1, :a => 2, :c => { "b" => 3, :b => 4 } }, %({\"a\":2,\"c\":{\"b\":4}}) ]]
84+
[ { 1 => 1, 2 => "a", 3 => :b, 4 => nil, 5 => false }, %({\"1\":1,\"2\":\"a\",\"3\":\"b\",\"4\":null,\"5\":false}) ]]
8685

8786
RangeTests = [[ 1..2, %("1..2")],
8887
[ 1...2, %("1...2")],

0 commit comments

Comments
 (0)