~~~~
=head2 Json
$json = $app->freeze->Json;
$encoded = $json->utf8->encode($data);
Returns L<JSON> object.
=cut
has 'Json' => (
is => 'rw',
isa => 'JSON',
la
zy => 1,
default => sub {
load JSON;
JSON->new;
}
);
=head2 Yaml
$yaml = $app->freeze->Yaml;
Returns L<YAML> object.
=cut
has 'Yaml' => (
is
efault => sub {
load YAML;
YAML->new;
}
);
=head2 Storable
$json = $app->freeze->Storable;
Returns "Storable" string. L<Storable> deos not suppot new method.
=c
Nile::Deserializer - Data structures deserializer
=head1 SYNOPSIS
$data = $app->thaw->json($encoded);
$data = $app->thaw->yaml($encoded);
$data = $app->thaw->storable($encoded);
l($encoded);
# also deserialize method is an alias for freeze
$data = $app->deserialize->json($encoded);
=head1 DESCRIPTION
Nile::Deserializer - Data structures deserializer
=cut
use Nile
~~~~~~~~~~~~~~~~~
=head2 json()
$encoded = qq!{"lname":"elsheshtawy","fname":"ahmed","phone":{"home":"02222444","mobile":"012222333"}}!;
$data = $app->thaw->json($encoded);
# return
type_text {
my ($self, $content_type) = @_;
return $content_type =~ /(\bx(?:ht)?ml\b|text|json|javascript)/;
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub result
me=>"elsheshtawy", phone=>{mobile=>"012222333", home=>"02222444"}};
$encoded = $app->freeze->json($data);
$encoded = $app->freeze->yaml($data);
$encoded = $app->freeze->storable($data);
->xml($data);
# also serialize method is an alias for freeze
$encoded = $app->serialize->json($data);
=head1 DESCRIPTION
Nile::Serializer - Data structures Serializer
=cut
#use Nile::Base
~~~~~~~~~~~~~~~~~
=head2 json()
$data = {fname=>"ahmed", lname=>"elsheshtawy", phone=>{mobile=>"012222333", home=>"02222444"}};
$encoded = $app->freeze->json($data);
# returns: