libjson-tiny-perl/examples/json_pp.pl
2018-03-27 21:25:33 +02:00

11 lines
243 B
Perl

BEGIN { $ENV{PERL_JSON_BACKEND} = 0; } # JSON::PP.
use JSON;
my @json
= split /-{4}/, do { open my $fh, '<sample.json'; local $/ = undef; <$fh> };
sub json_pp { my $j = JSON->new; [ map { $j->decode($_) } @json ]; }
my $value = json_pp;