#!/usr/bin/perl
#
# json_prettify.pl <FName>
#
# Prettifies FName and writes it to FName.out
#
use strict;
use warnings;
use JSON;
my $json = JSON->new->allow_nonref;
while (my $FName = shift) {
my $oname = $FName . ".out";
my $txt;
{
local $/;
open my $FH, '<', $FName or die "no! $!\n";
$txt = <$FH>;
}
my $data = $json->decode($txt);
$txt = $json->pretty->encode($data);
open my $OFH, '>', $oname or die "No no no! $!\n";
print $OFH $txt;
}
I really need to make a thumb drive with my local ~/bin directory copied to it for when I visit other sites... ;^)
...roboticus
When your only tool is a hammer, all problems look like your thumb. |