Hide Forgot
JSON:PP escapes "'" characters, which is not allowed according to RFC 4627 and will cause deserialization errors with other JSON implementations: $ perl -Ilib -MJSON::PP -MData::Dumper -we "print Dumper(encode_json([\"<<'>>\"]))" $VAR1 = '["<<\'>>"]'; (The documentation still refers to_json, which has been obsoleted, BTW.)
The solidus escaping an apostrophe is result of Data::Dumper::Dumper(). The JSON::PP::encode_json() does not do that. See simpler case: $ perl -MJSON::PP -e "print encode_json([qq{'}]), qq{\n}" ["'"]
Ugh, sorry about that. You are right, of course. This part of the source code confused me: my %esc = ( "\n" => '\n', "\r" => '\r', "\t" => '\t', "\f" => '\f', "\b" => '\b', "\"" => '\"', "\\" => '\\\\', "\'" => '\\\'', ); $arg =~ s/([\x22\x5c\n\r\t\f\b])/$esc{$1}/g; ' is present in the hash, but not in the regular expression.