Project

General

Profile

Bug #4868

ActiveSupport::JSON.decode Fails Decoding Date/Time String

Added by tboilard (Tom Boilard) over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.4]
Backport:
[ruby-core:36955]

Description

Issuing the command...

ActiveSupport::JSON.decode('[{"created_at":"2011-06-10T18:09:09-04:00"}]')

using the rails console results in the following error...

Psych::SyntaxError: couldn't parse YAML at line 1 column 30
from /Users/tboilard/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych.rb:148:in parse'
from /Users/tboilard/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych.rb:148:inparse_stream'
from /Users/tboilard/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych.rb:119:in parse'
from /Users/tboilard/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych.rb:106:inload'
from /Users/tboilard/.rvm/gems/ruby-1.9.2-p180@rails307/gems/activesupport-3.0.7/lib/active_support/json/backends/yaml.rb:15:in decode'
from /Users/tboilard/.rvm/gems/ruby-1.9.2-p180@rails307/gems/activesupport-3.0.7/lib/active_support/json/decoding.rb:14:indecode'
from (irb):46
from /Users/tboilard/.rvm/gems/ruby-1.9.2-p180@rails307/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in start'
from /Users/tboilard/.rvm/gems/ruby-1.9.2-p180@rails307/gems/railties-3.0.7/lib/rails/commands/console.rb:8:instart'
from /Users/tboilard/.rvm/gems/ruby-1.9.2-p180@rails307/gems/railties-3.0.7/lib/rails/commands.rb:23:in '
from script/rails:6:inrequire'
from script/rails:6:in `'

Running Rails 3.0.7 and ruby-1.9.2-p180.

Issue was discovered while updating a rails 2.3.11 app to rails 3.

Please let me know if you need any other information.

Thanks
Tom


Related issues

Is duplicate of Ruby master - Bug #4479: Psych fails to parse timestamps which is parsable by SyckThird Party's Issuetenderlovemaking (Aaron Patterson)03/08/2011Actions

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Status changed from Open to Third Party's Issue

Report it to ActiveSupport.
The bundled JSON module does not provide JSON.decode.

Updated by tboilard (Tom Boilard) over 9 years ago

From the error message above it appears that the issue is related to ruby 1.9.2 and psych. The issue does not occur when running rails 3.0.7 and ruby 1.8.7.

Updated by sakuro (Sakuro OZAWA) over 9 years ago

=begin
Same as #4479 ?
=end

Updated by nagachika (Tomoyuki Chikanaga) over 9 years ago

  • Category set to lib
  • Status changed from Third Party's Issue to Closed
  • Target version set to 1.9.2

Hi,

Tom, thank you for your report.

I think this issue was fixed in trunk by r30957.
And it was already back-ported to ruby_1_9_2 branch by r31769.
Please wait the new 1.9.2 patch level release.

Regards,

Also available in: Atom PDF