Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

AS::JSON Yaml backend sometimes do not honor AS:parse_json_times

#6544

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

Reported by Sakuro · March 8th, 2011 @ 04:31 AM

State: committed
Milestone: 3.1
Assigned to: Santiago Pastorino Santiago Pastorino
Importance: Low

Activity

  1. Sakuro
    Sakuro

    Actually, it simply ignores parse_json_times:)

    March 8th, 2011 @ 04:41 AM

  2. Diego Carrion
    Diego Carrion
    • Tag set to activesupport yaml
    • Assigned user set to Santiago Pastorino

    Attached patch fixes the problem

    March 10th, 2011 @ 12:48 AM

  3. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open
    • Milestone set to 3.1
    • Importance changed from to Low

    March 10th, 2011 @ 01:59 AM

  4. Diego Carrion
    Diego Carrion

    Hi Santiago, is the patch ok?

    March 13th, 2011 @ 12:04 AM

  5. John Firebaugh
    John Firebaugh

    +1, I encountered this in 3.0.5 as well.

    March 21st, 2011 @ 11:44 PM

  6. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to committed

    Pushed to master

    March 23rd, 2011 @ 12:13 AM