encode#
Perl data to JSON text, with this object’s options.
Synopsis#
my $text = JSON::XS->new->canonical->encode({ b => 1, a => [undef, \1] });
# {"a":[null,true],"b":1}
What you get back#
The JSON text: characters, or UTF-8 bytes under utf8. Dies on what JSON cannot represent unless an option allows it: a blessed object, a code reference, a reference to a scalar other than 0 or 1, nesting deeper than max_depth.