2 use warnings FATAL => 'all';
4 use Test::Without::Module 'Cpanel::JSON::XS';
6 use JSON::MaybeXS qw/:legacy/;
10 my $in = '[1, 2, 3, 4]';
13 my $arr = from_json($in);
14 my $j = to_json($arr);
16 is(ref($arr), 'ARRAY');
23 $json_text = to_json($perl_scalar)
25 Converts the given Perl data structure to a json string.
27 This function call is functionally identical to:
29 $json_text = JSON->new->encode($perl_scalar)
32 $perl_scalar = from_json($json_text)
34 The opposite of "to_json": expects a json string and tries to parse it,
35 returning the resulting reference.
37 This function call is functionally identical to:
39 $perl_scalar = JSON->decode($json_text)