This project is archived and is in readonly mode.
AS::JSON Yaml backend sometimes do not honor AS:parse_json_times
Reported by Sakuro | March 8th, 2011 @ 04:31 AM | in 3.1
ActiveSupport::VERSION::STRING "3.1.0.beta" (commit: 1408b942d9c2c131a1cdcab97f49d74ce84dae38)
>> ActiveSupport::JSON.backend = 'Yaml'
=> "Yaml"
>> ActiveSupport.parse_json_times = true
=> true
>> ActiveSupport::JSON.decode('{"timestamp":"2011-03-08T13:24:00Z"}')
=> {"timestamp"=>2011-03-08 13:24:00 UTC} #parsed, correct
>> ActiveSupport::JSON.decode('["2011-03-08T13:24:00Z"]')
=> ["2011-03-08T13:24:00Z"] #not parsed, incorrect!
>> ActiveSupport.parse_json_times = false
=> false
>> ActiveSupport::JSON.decode('{"timestamp":"2011-03-08T13:24:00Z"}')
=> {"timestamp"=>2011-03-08 13:24:00 UTC} #parsed, incorrect!
>> ActiveSupport::JSON.decode('["2011-03-08T13:24:00Z"]')
=> ["2011-03-08T13:24:00Z"] #not parsed, correct
FYI, JSONGem backend works correctly.
>> ActiveSupport::JSON.backend = 'JSONGem'
=> "JSONGem"
>> ActiveSupport.parse_json_times = true
=> true
>> ActiveSupport::JSON.decode('{"timestamp":"2011-03-08T13:24:00Z"}')
=> {"timestamp"=>Tue, 08 Mar 2011 13:24:00 +0000} #parsed, correct
>> ActiveSupport::JSON.decode('["2011-03-08T13:24:00Z"]')
=> [Tue, 08 Mar 2011 13:24:00 +0000] #parsed, correct
>> ActiveSupport.parse_json_times = false
=> false
>> ActiveSupport::JSON.decode('{"timestamp":"2011-03-08T13:24:00Z"}')
=> {"timestamp"=>"2011-03-08T13:24:00Z"} #not parsed, correct
>> ActiveSupport::JSON.decode('["2011-03-08T13:24:00Z"]')
=> ["2011-03-08T13:24:00Z"] #not parsed, correct
Comments and changes to this ticket
-
Diego Carrion March 10th, 2011 @ 12:48 AM
- Tag set to activesupport yaml
- Assigned user set to Santiago Pastorino
Attached patch fixes the problem
-
Santiago Pastorino March 10th, 2011 @ 01:59 AM
- State changed from new to open
- Milestone set to 3.1
- Importance changed from to Low
-
Santiago Pastorino March 23rd, 2011 @ 12:13 AM
- State changed from open to committed
Pushed to master
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>