crack icon indicating copy to clipboard operation
crack copied to clipboard

Crack::JSON can't parse valid json string with UTF-8 character

Open bblimke opened this issue 10 years ago • 0 comments

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.

bblimke avatar Nov 08 '14 21:11 bblimke