Encode with "\u four-hex-digits" in JSON::XS for Perl Encode with "\u four-hex-digits" in JSON::XS for Perl json json

Encode with "\u four-hex-digits" in JSON::XS for Perl


->ascii will restrict the output to US-ASCII characters.

my $json = JSON::XS->new->ascii;my $text = $json->encode($hash);


use JSON::XS ();use JSON; # uses JSON::XS by default (if available)$json_text = to_json( { text => 'Dragón' }, { 'ascii' => 1 } );