Scott Penrose

LWP JSON

Scott is an expert software developer with over 30 years experience, specialising in education, automation and remote data.

Quick script to present pretty printed JSON from a GET request

#!Perl
#!/usr/bin/perl
use perl5i::2;
use LWP::Simple;
use JSON;

my $data = get(shift) || die("Failed to get URL $!");
my $json = JSON->new->allow_nonref;
say $json->pretty->encode( $json->decode( $data ) );