ascii#

The option setters: ascii, latin1, utf8, indent, canonical, space_before, space_after, allow_nonref, shrink, allow_blessed, convert_blessed, relaxed, allow_unknown, allow_tags, and JSON::PP’s own allow_singlequote, allow_barekey, allow_bignum, loose, escape_slash and as_nonblessed.

Synopsis#

my $json = JSON::PP->new->allow_singlequote->allow_barekey;
my $data = $json->decode(q({key: 'value'}));

What you get back#

The object itself, with the option on (no argument, or a defined true one) or off.

  • allow_singlequote: strings may also be quoted with '.

  • allow_barekey: an object’s keys may be bare words of ASCII word characters, $ and non-ASCII characters.

  • allow_bignum: numbers too large or too precise for Perl decode to Math::BigInt and Math::BigFloat objects, and such objects encode as numbers.

  • loose: unknown backslash escapes and control characters are taken as they are.

  • escape_slash: / is written as \/.

  • as_nonblessed: with allow_blessed, a blessed hash or array is encoded as if it were not blessed.

  • shrink is accepted and changes nothing.