NAME

Data::Clean::FromJSON - Clean data from JSON decoder

VERSION

version 0.10

SYNOPSIS

use Data::Clean::FromJSON;
use JSON;
my $cleanser = Data::Clean::FromJSON->new;
my $data    = JSON->new->decode('[true]'); # -> [bless(do{\(my $o=1)},"JSON::XS::Boolean")]
my $cleaned = $cleanser->clean_in_place($data); # -> [1]

DESCRIPTION

This class can convert JSON::PP::Boolean (or JSON::XS::Boolean) objects to 1/0 values.

METHODS

new(%opts) => $obj

Create a new instance. For list of known options, see Data::Clean::Base. Data::Clean::FromJSON sets some defaults.

"JSON::PP::Boolean" => ['one_or_zero']
"JSON::XS::Boolean" => ['one_or_zero']

$obj->clean_in_place($data) => $cleaned

Clean $data. Modify data in-place.

$obj->clone_and_clean($data) => $cleaned

Clean $data. Clone $data first.

AUTHOR

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.