J
Jonathan Rochkind
The documentation for the ruby JSON classes (http://json.rubyforge.org/)
implies that it handles unicode escaping fine. But I'm having trouble
with parsing JSON with a unicode escape sequence in it. I am using the
'ext' parser (JSON::Ext:arser) not the 'pure' parser. version 1.1.2,
which appears to still be the latest.
Here is some test JSON, that's actually an excerpt from some JSON
returned to me by a third party web service. Finally boiled it down to
the simplest demonstration case. I saved it in a file, but here's what's
in the text file:
=====
{ "key": 'something \x26 more' }
=====
I believe that is valid json, containing an escaped unicode char? But
JSON.parse on that string throws, complaining:
JSON:arserError: unexpected token at '{ "summary": ' \u0026 ' }
I have verified it is the /x26 that's doing it. It doesn't like \x
escaped unicode.
Am I doing something wrong? Is the JSON I am receiving from the third
party bad somehow? This is such a widely used library that I'd be
surprised if it's broken and can't parse input including unicode escape
sequences... but that's what it looks like to me. Feedback?
implies that it handles unicode escaping fine. But I'm having trouble
with parsing JSON with a unicode escape sequence in it. I am using the
'ext' parser (JSON::Ext:arser) not the 'pure' parser. version 1.1.2,
which appears to still be the latest.
Here is some test JSON, that's actually an excerpt from some JSON
returned to me by a third party web service. Finally boiled it down to
the simplest demonstration case. I saved it in a file, but here's what's
in the text file:
=====
{ "key": 'something \x26 more' }
=====
I believe that is valid json, containing an escaped unicode char? But
JSON.parse on that string throws, complaining:
JSON:arserError: unexpected token at '{ "summary": ' \u0026 ' }
I have verified it is the /x26 that's doing it. It doesn't like \x
escaped unicode.
Am I doing something wrong? Is the JSON I am receiving from the third
party bad somehow? This is such a widely used library that I'd be
surprised if it's broken and can't parse input including unicode escape
sequences... but that's what it looks like to me. Feedback?