package Mojo::JSON_XS;
use strict;
use warnings;
our $VERSION = 1.022;
# From groups.google.com/forum/#!msg/mojolicious/a4jDdz-gTH0/Exs0-E1NgQEJ
use Cpanel::JSON::XS;
use Mojo::JSON;
use Mojo::Util
'monkey_patch';
my $Binary = Cpanel::JSON::XS->new->utf8;
my $Text = Cpanel::JSON::XS->new;
$_->canonical->allow_nonref->allow_unknown->allow_blessed->convert_blessed
->stringify_infnan->escape_s
onkey_patch 'Mojo::JSON', encode_json => sub { $Binary->encode(shift) };
monkey_patch 'Mojo::JSON', decode_json => sub { $Binary->decode(shift) };
monkey_patch 'Mojo::JSON', to_json => sub { $Text-
use Mojo::Base -strict;
use Test::More;
use_ok('Mojo::JSON_XS');
diag "Testing Mojo::JSON_XS $Mojo::JSON_XS::VERSION, Perl $], $^X";
done_testing();
A straight copy of Mojolicious@5.68:t/mojo/json.t (c) Sebastian Riedel
package JSONTest;
use Mojo::Base -base;
has 'something' => sub { {} };
sub TO_JSON { shift->something }
package main;
use Mo
se Mojo::JSON_XS;
use Mojo::JSON qw(decode_json encode_json false from_json j to_json true);
use Mojo::Util 'encode';
use Scalar::Util 'dualvar';
sub _cpanel_version { !! eval { Cpanel::JSON::XS->VER
ray
my $array = decode_json '[]';
is_deeply $array, [], 'decode []';
$array = decode_json '[ [ ]]';
is_deeply $array, [[]], 'decode [ [ ]]';
# Decode number
$array = decode_json '[0]';
is_deeply $arr