From 1f7b7d9cc2f482d0375ca4993decae0f371c8129 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 17 Nov 2019 21:09:31 +0100 Subject: add json2json (useful to re-gain canonical stations.json format) --- share/json2json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 share/json2json 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 ); -- cgit v1.2.3