A very annoying bug popped up in the latest version. The to-json routine in no longer properly escaping double quote in hash key strings. It's probably not a common thing, but it happens. I have moderately large JSON files files I process every sunday and they failed hard after I had upgraded to 2020.07 and updated all my installed modules.
use JSON::Fast;
my %data = 'It\'s the "REAL" deal!' => 'BORKEN!!';
say my $json = %data.&to-json;
say "WAT!? The double quotes aren't escaped... that isn't valid JSON";
say $json.&from-json
Output
{
"It's the "REAL" deal!": "BORKEN!!"
}
WAT!? The double quotes aren't escaped... that isn't valid JSON
unexpected R in an object at 15
in block at /home/steve/.perl6/share/perl6/site/sources/0FE3EE5CA05AEDC84BC326E7EBBACCB6647BD427 (JSON::Fast) line 594
in sub parse-obj at /home/steve/.perl6/share/perl6/site/sources/0FE3EE5CA05AEDC84BC326E7EBBACCB6647BD427 (JSON::Fast) line 556
in sub parse-thing at /home/steve/.perl6/share/perl6/site/sources/0FE3EE5CA05AEDC84BC326E7EBBACCB6647BD427 (JSON::Fast) line 647
in sub from-json at /home/steve/.perl6/share/perl6/site/sources/0FE3EE5CA05AEDC84BC326E7EBBACCB6647BD427 (JSON::Fast) line 683
in block <unit> at myjson.p6 line 9
Seems to only be an issue in hash keys, regular strings are ok
A very annoying bug popped up in the latest version. The to-json routine in no longer properly escaping double quote in hash key strings. It's probably not a common thing, but it happens. I have moderately large JSON files files I process every sunday and they failed hard after I had upgraded to 2020.07 and updated all my installed modules.
Output
Seems to only be an issue in hash keys, regular strings are ok