Scott Penrose

LWP JSON

Scott Penrose is a perl hacker with an interest in home automation. He has been playing with electronics since he was old enough to burn his fingers with a soldering iron.

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 ) );