timo / json_fast

a naive imperative json parser in perl6, to evaluate performance against JSON::Tiny
Artistic License 2.0
26 stars 20 forks source link

quoted solidus is not unquoted #36

Closed gfldex closed 6 years ago

gfldex commented 6 years ago
perl6 -MJSON::Fast -e 'dd from-json(q<"http:\/\/perl6.org">)'
# "http:\\\\/\\\\/perl6.org"
# expected: http://perl6.org

Apperently that is a thing: https://stackoverflow.com/questions/19176024/how-to-escape-special-characters-in-building-a-json-string#answer-27516892

gfldex commented 6 years ago

And that thing seams to be used widely by php-folk. Example: http://www.radio-browser.info/webservice/json/stations

zoffixznet commented 6 years ago

I'm having the same problem:

2018.02.24 zoffix@VirtualBox~$ perl6 -MJSON::Fast -e 'say from-json q|"\/"|'
\\/
2018.02.24 zoffix@VirtualBox~$ perl -MMojo::JSON=from_json -wlE 'say from_json q|"\/"|'
/

Downgrading to a commit before https://github.com/timo/json_fast/commit/7bb21580bcb8440fad09f56d256aa8b273b76280 fixes the problem:

zef uninstall JSON::Fast
zef install https://github.com/timo/json_fast/archive/f8b5561fdb5882263898aa1e6b5d962a50898bb1.zip
timo commented 6 years ago

i believe i fixed this is release 0.9.10; please try it on your real-life data, too

zoffixznet commented 6 years ago

Fixed for me.

gfldex commented 6 years ago

Fixed for me, tested with fairly large dataset.