Canonicalize output JSON, so that we do not waste bandwidth with empty diffs.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 20 Jun 2015 11:43:28 +0000 (13:43 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 20 Jun 2015 11:43:28 +0000 (13:43 +0200)
remoteglot.pl

index 9cc82e3..3c12569 100755 (executable)
@@ -774,7 +774,9 @@ sub output_json {
        }
        $json->{'refutation_lines'} = \%refutation_lines;
 
-       my $encoded = JSON::XS::encode_json($json);
+       my $json_enc = JSON::XS->new;
+       $json_enc->canonical(1);
+       my $encoded = $json_enc->encode($json);
        unless ($historic_json_only || !defined($remoteglotconf::json_output) ||
                (defined($last_written_json) && $last_written_json eq $encoded)) {
                atomic_set_contents($remoteglotconf::json_output, $encoded);