Skip to content

Commit

Permalink
api json output is canonical
Browse files Browse the repository at this point in the history
  • Loading branch information
eserte committed Apr 9, 2016
1 parent 3b70d7e commit 234c20c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions BBBikeCGI/API.pm
Expand Up @@ -3,7 +3,7 @@
#
# Author: Slaven Rezic
#
# Copyright (C) 2009,2013,2014,2015 Slaven Rezic. All rights reserved.
# Copyright (C) 2009,2013,2014,2015,2016 Slaven Rezic. All rights reserved.
# This package is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
Expand All @@ -17,7 +17,7 @@ package BBBikeCGI::API;

use strict;
use vars qw($VERSION);
$VERSION = '0.04';
$VERSION = '0.05';

use JSON::XS qw();

Expand Down Expand Up @@ -55,11 +55,11 @@ sub action_revgeocode {
$cr = join("/", @cr);
}
print $q->header(-type => 'text/plain', -access_control_allow_origin => '*');
print JSON::XS->new->ascii->encode({ crossing => $cr,
bbbikepos => $xy,
origlon => $lon,
origlat => $lat,
});
print JSON::XS->new->canonical->ascii->encode({ crossing => $cr,
bbbikepos => $xy,
origlon => $lon,
origlat => $lat,
});
}

sub action_config {
Expand All @@ -79,7 +79,7 @@ sub action_config {
}

$r->{modules_info} = \%modules_info;
print JSON::XS->new->ascii->encode($r);
print JSON::XS->new->canonical->ascii->encode($r);
}

# Module info can contain:
Expand Down

0 comments on commit 234c20c

Please sign in to comment.