lt::JSON;
$Data::Crumbr::Default::JSON::VERSION = '0.1.2';
# ABSTRACT: "JSON" profile for Data::Crumbr::Default
use Data::Crumbr::Util;
sub profile {
my $json_encoder = Data::Crumbr::Util::json_le
ey_encoder => $json_encoder,
value_encoder => $json_encoder,
};
} ## end sub profile
1;
__END__
=pod
=encoding utf-8
=head1 NAME
Data::Crumbr::Default::JSON - "JSON" profile for Da
version 0.1.2
=head1 DESCRIPTION
Profile for JSON encoder
=head1 INTERFACE
=over
=item B<< profile >>
my $profile = Data::Crumbr::Default::JSON->profile();
returns a default profile, i.e. e
:URI::VERSION = '0.1.2';
# ABSTRACT: "JSON" profile for Data::Crumbr::Default
use Data::Crumbr::Util;
sub profile {
my $json_encoder = Data::Crumbr::Util::json_leaf_encoder();
my $uri_encoder
_encoder,
value_encoder => $json_encoder,
};
} ## end sub profile
1;
__END__
=pod
=encoding utf-8
=head1 NAME
Data::Crumbr::Default::URI - "JSON" profile for Data::Crumbr::Default
h_vars >;
use Scalar::Util qw< blessed >;
use Data::Crumbr::Util;
my $jenc = Data::Crumbr::Util::json_leaf_encoder();
my $ienc = Data::Crumbr::Util::id_encoder();
has array_open => (default =
:Crumbr
use strict;
use Carp;
use Scalar::Util qw< reftype blessed >;
sub json_leaf_encoder {
require B;
return \&_json_leaf_encode;
}
{
my $slash_escaped;
BEGIN {
$slash_escaped
0x0A => 'n',
0x0D => 'r',
0x09 => 't',
};
} ## end BEGIN
sub _json_leaf_encode {
return 'null' unless defined $_[0];
my $reftype = ref($_[0]);
re
, $lo;
}
} split //, $_[0];
return qq<"> . $string . qq<">;
} ## end sub _json_leaf_encode
}
sub uri_encoder {
require Encode;
return \&_uri_encoder;
}
{
my %is_unre
')->($data);
# here/hey "you"
# here/what "ever"
# JSON profile produces valid JSON "slices"
$encoded = crumbr(profile => 'JSON')->($data);
# {"here":{"hey":"you"}}
# {"here":{"what
[ 1..3 ],
something => "funny \x{263A} ☻",
},
};
If you encode this e.g. in JSON, it will be easy to parse with
the right program, but not from the shell, even if you pretty
prin
m *
hash keys encoded as JSON strings, surrounded by curly brackets:
hash_key_prefix => '['
hash_key_suffix => ']'
hash_key_encoder => Data::Crumbr::Util::json_leaf_encoder
=item *
n