Files
sdb/test/fixjson.pl
2014-01-15 01:02:57 +01:00

14 lines
237 B
Perl

#!/usr/bin/perl
my $str = "";
while(<STDIN>) {
s,\n,,g;
$str .= $_;
}
$str=~s,(\s+):,:,g;
$str=~s,}(\s+),},g;
$str=~s/,(\s+)/,/g;
$str=~s/:(\s+)/:/g;
$str=~s,{([^"])([^:]*),{"$1$2",g;
$str=~s/,([^"])([^:]*)/,"$1$2"/g;
print $str."\n";