Hoppy::Formatter::JSON;
use strict;
use warnings;
use base qw( Hoppy::Base );
use Encode;
use JSON;
sub serialize {
my ( $self, $data, $code ) = @_;
my $json = JSON::to_json($data);
if (
utf8::decode($json);
}
return $json;
}
sub deserialize {
my ( $self, $json, $code ) = @_;
$json = decode( "utf8", $json );
my $data = JSON::from_json($json);
return $data
ormatter::JSON - IO formatter that can translate from or to JSON.
=head1 SYNOPSIS
use Hoppy::Formatter::JSON;
my $formatter = Hoppy::Formatter::JSON->new;
# from perl data to JSON
my $dat