From: "vbatts (Vincent Batts)" Date: 2012-11-10T01:56:08+09:00 Subject: [ruby-core:49170] [ruby-trunk - Bug #7306] BigDecimal does not properly marshal to JSON and back Issue #7306 has been updated by vbatts (Vincent Batts). Shouldn't it reinitialize a Bigdecimal object, with value "Infinity"? ---------------------------------------- Bug #7306: BigDecimal does not properly marshal to JSON and back https://bugs.ruby-lang.org/issues/7306#change-32722 Author: vbatts (Vincent Batts) Status: Rejected Priority: Normal Assignee: naruse (Yui NARUSE) Category: ext Target version: ruby -v: ruby 2.0.0dev (2012-11-06 trunk 37483) [x86_64-linux] $ ruby -v -S irb -r bigdecimal -r json ruby 2.0.0dev (2012-11-06 trunk 37483) [x86_64-linux] /opt/ruby/2.0.0-git4e73323a6/lib/ruby/2.0.0/irb/ext/save-history.rb:29: warning: method redefined; discarding old save_history= /opt/ruby/2.0.0-git4e73323a6/lib/ruby/2.0.0/irb/extend-command.rb:211: warning: previous definition of save_history= was here irb(main):001:0> inf = BigDecimal.new('Infinity') => # irb(main):002:0> inf2 = JSON.load(inf.to_json) => "Infinity" irb(main):003:0> inf3 = JSON.parse(inf.to_json) JSON::ParserError: 757: unexpected token at '"Infinity"' from /opt/ruby/2.0.0-git4e73323a6/lib/ruby/2.0.0/json/common.rb:149:in `parse' from /opt/ruby/2.0.0-git4e73323a6/lib/ruby/2.0.0/json/common.rb:149:in `parse' from (irb):3 from /opt/ruby/2.0.0-git4e73323a6/bin/irb:12:in `
' irb(main):004:0> JSON.dump inf => "\"Infinity\"" irb(main):005:0> JSON.load(JSON.dump(inf)) => "Infinity" -- http://bugs.ruby-lang.org/