summaryrefslogtreecommitdiff
path: root/share/json2json
diff options
context:
space:
mode:
Diffstat (limited to 'share/json2json')
-rwxr-xr-xshare/json2json14
1 files changed, 14 insertions, 0 deletions
diff --git a/share/json2json b/share/json2json
new file mode 100755
index 0000000..5cad10f
--- /dev/null
+++ b/share/json2json
@@ -0,0 +1,14 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use 5.010;
+
+use File::Slurp qw(read_file write_file);
+use JSON;
+
+my $json_str = read_file('stations.json');
+my $stations = JSON->new->utf8->decode($json_str);
+@{$stations} = sort { $a->{name} cmp $b->{name} } @{$stations};
+my $json_out = JSON->new->utf8->canonical->pretty->encode($stations);
+write_file( 'stations.json', $json_out );