Skip to content

Commit 2f8485e

Browse files
oschwaldautarch
authored andcommitted
Use JSON::MaybeXS instead of JSON
1 parent 6c36273 commit 2f8485e

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Changes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{{$NEXT}}
22

3+
- The JSON plugin now uses JSON::MaybeXS instead of JSON.pm. Patch by Greg
4+
Oschwald. GitHub #37.
5+
6+
37
0.27 2015-07-04
48

59
[BUG FIXES]

lib/Code/TidyAll/Plugin/JSON.pm

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package Code::TidyAll::Plugin::JSON;
33
use strict;
44
use warnings;
55

6-
use JSON ();
6+
use JSON::MaybeXS ();
77
use Moo;
88

99
our $VERSION = '0.28';
@@ -16,7 +16,12 @@ sub transform_source {
1616
my $self = shift;
1717
my $source = shift;
1818

19-
my $json = JSON->new->utf8->relaxed->pretty->canonical;
19+
my $json = JSON::MaybeXS->new(
20+
canonical => 1,
21+
pretty => 1,
22+
relaxed => 1,
23+
utf8 => 1,
24+
);
2025

2126
$json = $json->ascii if $self->ascii;
2227

@@ -25,7 +30,7 @@ sub transform_source {
2530

2631
1;
2732

28-
# ABSTRACT: Use the JSON module to tidy JSON documents with tidyall
33+
# ABSTRACT: Use the JSON::MaybeXS module to tidy JSON documents with tidyall
2934

3035
__END__
3136
@@ -41,8 +46,8 @@ __END__
4146
4247
=head1 DESCRIPTION
4348
44-
Uses L<JSON> to format JSON files. Files are put into a canonical format with
45-
the keys of objects sorted.
49+
Uses L<JSON::MaybeXS> to format JSON files. Files are put into a canonical
50+
format with the keys of objects sorted.
4651
4752
=head1 CONFIGURATION
4853

0 commit comments

Comments
 (0)