| Data-Serializer documentation | Contained in the Data-Serializer distribution. |
Data::Serializer::JSON - Creates bridge between Data::Serializer and JSON
use Data::Serializer::JSON;
Module is used internally to Data::Serializer
Naoya Ito <naoya@bloghackers.net>
Patch to JSON 2 by Makamaka <makamaka@donzoko.net>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl(1), Data::Serializer(3), JSON(3).
| Data-Serializer documentation | Contained in the Data-Serializer distribution. |
package Data::Serializer::JSON; BEGIN { @Data::Serializer::JSON::ISA = qw(Data::Serializer) } use warnings; use strict; use JSON; use vars qw($VERSION @ISA); $VERSION = '0.04'; sub serialize { return JSON->VERSION < 2 ? JSON->new->objToJson($_[1]) : JSON->new->utf8->encode($_[1]); } sub deserialize { #return JSON->VERSION < 2 ? JSON->new->jsonToObj($_[1]) : JSON->new->decode($_[1]); $_[1] and return JSON->VERSION < 2 ? JSON->new->jsonToObj($_[1]) : JSON->new->utf8->decode($_[1]); } 1; __END__