#!/usr/bin/perl # # json_prettify.pl # # 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; }