crack
crack copied to clipboard
Crack 0.4.3 cannot parse two consecutive dates
Run the following code:
require 'crack'
class Launcher
def initialize
end
def run
strj = "{\"budget_start\":\"2014-02-28\",\"budget_end\":\"2014-02-20\"}"
resp = Crack::JSON.parse(strj);
print "\n"
end
end
l = Launcher.new
l.run
It produces "Invalid JSON string" exception.
Replace the strj string to:
strj = "{\"budget_start\":\"2014-02-28\",\"budget_end\":\"2014\"}"
It works fine.
Yup. It's a bug
Crack::JSON.convert_json_to_yaml strj
=> "{\"budget_start\":!!timestamp \"2014-02-28\", \"budget_end\"!!timestamp \"2014-02-20\"}"