jnunemaker / crack

Really simple JSON and XML parsing, ripped from Merb and Rails.
MIT License
541 stars 93 forks source link

Crack 0.4.3 cannot parse two consecutive dates #58

Closed ypolonsky closed 9 months ago

ypolonsky commented 8 years ago

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.

bf4 commented 4 years ago

Yup. It's a bug

Crack::JSON.convert_json_to_yaml strj
=> "{\"budget_start\":!!timestamp \"2014-02-28\", \"budget_end\"!!timestamp  \"2014-02-20\"}"