crack
crack copied to clipboard
Crack::JSON can't parse valid json string with UTF-8 character
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 be a problem with Psych not being able to handle well \u0026
character.