The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

VERSION

This document describes version 0.36 of Data::Clean::FromJSON (from Perl distribution Data-Clean-JSON), released on 2016-05-27.

SYNOPSIS

 use Data::Clean::FromJSON;
 use JSON;
 my $cleanser = Data::Clean::FromJSON->get_cleanser;
 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

CLASS->get_cleanser => $obj

Return a singleton instance, with default options. Use new() if you want to customize options.

CLASS->new() => $obj

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

Clean $data. Modify data in-place.

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

Clean $data. Clone $data first.

FAQ

Why am I getting 'Modification of a read-only value attempted at lib/Data/Clean.pm line xxx'?

[2013-10-15 ] This is also from Data::Clone::clone() when it encounters JSON::{PP,XS}::Boolean objects. You can use clean_in_place() instead of clone_and_clean(), or clone your data using other cloner like Sereal.

ENVIRONMENT

LOG_CLEANSER_CODE

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Data-Clean-JSON.

SOURCE

Source repository is at https://github.com/perlancar/perl-Data-Clean-JSON.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Clean-JSON

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by perlancar@cpan.org.

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