```{index} single: encode_json (JSON::PP) ``` ```{index} single: JSON::PP::encode_json ``` # encode_json Perl data to UTF-8 encoded JSON text. ## Synopsis ```perl use JSON::PP; my $bytes = encode_json { name => "caf\x{e9}" }; # {"name":"caf\xc3\xa9"} ``` ## What you get back The JSON text as UTF-8 bytes: `JSON::PP->new->utf8->encode($data)`. Exported by default.