Commit 1f7b7d9c authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

add json2json (useful to re-gain canonical stations.json format)

parent 2c20e8ca
Loading
Loading
Loading
Loading

share/json2json

0 → 100755
+14 −0
Original line number Diff line number Diff line
#!/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 );