package WWW::Session::Serialization::JSON;

use 5.006;
use strict;
use warnings;

use JSON;

=head1 NAME

WWW::Session::Serialization::JSON - Serialization engine for WWW::Session with JSON backend


JSON serialization engine for WWW::Session objects

=head1 VERSION

Version 0.12


our $VERSION = '0.12';


This module handles serialization for WWW::Session objects

The object implements two main methods : serialize() and expand()

    use WWW::Session::Serialization::JSON;

    my $serializer = WWW::Session::Serialization::JSON->new();
    $string = $serializer->serialize($structure);
    $structure = $serializer->expand($string);


=head2 new

Creates a new WWW::Session::Serialization::JSON object

Usage :

    my $serializer = WWW::Session::Serialization::JSON->new();
No arguments required.


sub new {
    my $class = shift;
    my $self = {};
    bless $self,$class;
    return $self;

=head2 serialize

Serializes a structure and returns a string containing all the data


sub serialize {
    my ($self,$data) = @_;
    return to_json($data);

=head2 expand

Deserializes string and returns a structure containing all the data

sub expand {
    my ($self,$string) = @_;
    return from_json($string);

=head1 AUTHOR

Gligan Calin Horea, C<< <gliganh at> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-www-session at>, or through
the web interface at L<>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc WWW::Session::Serialization::JSON

You can also look for information at:

=over 4

=item * RT: CPAN's request tracker (report bugs here)


=item * AnnoCPAN: Annotated CPAN documentation


=item * CPAN Ratings


=item * Search CPAN





Copyright 2012 Gligan Calin Horea.

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See for more information.


1; # End of WWW::Session::Serialization::JSON