summaryrefslogtreecommitdiff
path: root/share/json2json
blob: 5cad10f782914cc9a0816a82db071890826023ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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 );