App::Serializer::Json - Interface for serialization and deserialization


App-Context documentation  | view source Contained in the App-Context distribution.

Index


NAME

Top

App::Serializer::Json - Interface for serialization and deserialization

SYNOPSIS

Top

    use App;

    $context = App->context();
    $serializer = $context->service("Serializer");  # or ...
    $serializer = $context->serializer();
    $data = {
        an => 'arbitrary',
        collection => [ 'of', 'data', ],
        of => {
            arbitrary => 'depth',
        },
    };
    $json = $serializer->serialize($data);
    $data = $serializer->deserialize($json);
    print $serializer->dump($data), "\n";

DESCRIPTION

Top

A Serializer allows you to serialize a structure of data of arbitrary depth to a scalar and deserialize it back to the structure.

The Json serializer uses JSON data structure syntax as the serialized form of the data. It uses the JSON module from CPAN to perform the deserialization and serialization.


App-Context documentation  | view source Contained in the App-Context distribution.