From: Steinar H. Gunderson Date: Sat, 20 Jun 2015 11:43:28 +0000 (+0200) Subject: Canonicalize output JSON, so that we do not waste bandwidth with empty diffs. X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=d39bafd9fb4cc0725786ab815bf7dd5fb03ef15e Canonicalize output JSON, so that we do not waste bandwidth with empty diffs. --- diff --git a/remoteglot.pl b/remoteglot.pl index 9cc82e3..3c12569 100755 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -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);