# File test/objtest.rb, line 32 def test_to_json obj = Hash.new obj['foo'] = 'bar' obj['xyz'] = 1 obj['euler'] = 0.577215665 str = obj.to_json sobj = JSON::Lexer.new(str).nextvalue assert(sobj.class == Hash, "Hash was not generated by deserialization") assert(sobj['foo'] == 'bar', "error in serialization of a string to JSON") assert(sobj['xyz'] == 1, "error in serialization of a FixNum to JSON") assert(sobj['euler'] == 0.577215665, "error in serialization of a float to JSON") end