ata::Record::Serialize::Encode::json;
# ABSTRACT: encoded a record as JSON
use v5.12;
use strict;
use warnings;
use Data::Record::Serialize::Error { errors => ['json_backend'] }, -all;
use Moo::Ro
= '2.02';
BEGIN {
my $Cpanel_JSON_XS_VERSION = 3.0236;
# Module::Version doesn't load the code, so avoids loading
# Cpanel::JSON::XS's version of JSON::PP::Boolean which prevents
#
loading the version provided by JSON::PP if Cpanel::JSON::XS is
# too old. Symbol::delete_package could be used to remove
# Cpanel::JSON::XS's version, but it's better not to load it in
#
ze::Error { errors => ['yaml_backend'] }, -all;
use Types::Standard qw[ Enum ];
use JSON::PP; # needed for JSON::PP::true/false
use namespace::clean;
our $VERSION = '2.02';
BEGIN {
my $YAML
ML::XS::Boolean = 'JSON::PP';
YAML::XS::Dump( $_[1] );
};
}
elsif ( eval { require YAML::PP } ) {
my $processor = YAML::PP->new( boolean => 'JSON::PP' );
*e
fy' => ( is => 'ro', default => 1 );
sub _needs_eol { 1 }
sub to_bool { $_[1] ? JSON::PP::true : JSON::PP::false }
with 'Data::Record::Serialize::Role::Encode';
1;
#
# This file is p
ut to json
$s = Data::Record::Serialize->new( encode => 'json', \%attr );
$s->send( \%record );
# cleanup record before sending
$s = Data::Record::Serialize->new( encode => 'json',
a::Record::Serialize::Encode::ddump>
encode via L<Data::Dumper>
=item *
C<json> - L<Data::Record::Serialize::Encode::json>
=item *
C<null> - L<Data::Record::Serialize::Sink::null>
This is a comb
ansformed into a number. It
defaults to C<false>, unless a particular encoder requires it
(e.g. C<json>). To avoid unnecessary conversion overhead, set this to
C<false> if you are sure that your data