crack
crack copied to clipboard
Really simple JSON and XML parsing, ripped from Merb and Rails.
Parsing the following json "{\"data\":\"{\\"foo\\":\\"\\u0026\\"\"}""` raises "Crack::ParseError". i.e. ``` require 'json' require 'crack' json = JSON.generate({"data"=>"{\"foo\":\"\\u0026\""}) JSON.parse(json) Crack::JSON.parse(json) > `rescue in parse': Invalid JSON string (Crack::ParseError) ``` This seems to...
When incoming JSON to be parsed contains the character sequence `\u0000`, YAML blows up. `\u0000` converts to `\x00` with `unescape` just fine, but YAML chokes. Basically, this is because end-of-string...
Trying to run `jekyll serve` and getting errors about not being able to activate `crack` because of conflicting versions of dependency, `safe_yaml`. `Jekyll` requires ~>0.7.0 and `crack` ~>0.9.0. Exact error:...
When a call to Crack::JSON.parse with non-JSON text, such as arbitrary HTML, fails and the underlying system is utilizing the old 'syck' parser a Crack::ParseError will bubble up to the...
$ ruby1.9.1 --version ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] Full log here http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=623900#64
I'm using the parsing engine in order to get hash representation that will be serialized somewhere. In order for it to be serialized, the object cannot be singleton. Turns out,...
Crack adds the #attributes method to the String class when parsing xml which conflicts with Mongoid as Mongoid uses respond_to?(:attributes) when determining whether to load associations. Crack should likely not...
I've finally tracked down an issue I'm having to crack. (I bet that's been said before!) I'm using using hashrocket/mousetrap to connect to the CheddarGetter API. It depends on httparty...
{ "name" : "cm:content", "isAspect" : false, "title" : "Content", "description" : "Base Content Object", "parent" : { "name" : "cm:cmobject", "title" : "cmobject", "url" : "\/api\/classes\/cm_cmobject" }, "defaultValues" :...
I know support for the ISO 8601 time format was added a while back, but it seems to be inconsistent with how everyone else parses stuff. Observe: ``` >> require...