Skip to content

Instantly share code, notes, and snippets.



Created Jun 16, 2009
What would you like to do?
#!/usr/bin/env perl
use strict;
use warnings;
use LWP::Simple;
use JSON::XS;
my $file = shift;
my $json_text;
unless ($file) {
print "Usage: file\n";
if ($file =~ m!^https?://!) {
$json_text = get($file);
else {
open FH, $file or die "Cannot open $file: $!";
while(<FH>) {
$json_text .= $_;
my $json = new JSON::XS;
my $json_data = $json->decode($json_text);
print $json->pretty(1)->utf8->encode($json_data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.