Skip to content

Commit 6297ad5

Browse files
committed
Merge branch 'fix-unexpected-deserialization'
2 parents e8250a8 + 459a4cd commit 6297ad5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/kredis/type/json.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def type
88
end
99

1010
def cast_value(value)
11-
JSON.load(value)
11+
JSON.parse(value)
1212
end
1313

1414
def serialize(value)

test/types/scalar_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ class ScalarTest < ActiveSupport::TestCase
6060
json = Kredis.json "myscalar"
6161
json.value = { "one" => 1, "string" => "hello" }
6262
assert_equal({ "one" => 1, "string" => "hello" }, json.value)
63+
64+
json.value = {"json_class"=>"String", "raw"=>[97, 98, 99]}
65+
assert_equal({"json_class"=>"String", "raw"=>[97, 98, 99]}, json.value)
6366
end
6467

6568
test "invalid type" do

0 commit comments

Comments
 (0)