NAME

Data::Sah::Filter::perl::Str::try_decode_json - JSON-decode if we can, otherwise leave string as-is

VERSION

This document describes version 0.001 of Data::Sah::Filter::perl::Str::try_decode_json (from Perl distribution Data-Sah-Filter-perl-Str-try_decode_json), released on 2020-02-11.

SYNOPSIS

Use in Sah schema's prefilters (or postfilters) clause:

 ["str","prefilters",["Str::try_decode_json"]]

DESCRIPTION

This rule is sometimes convenient if you want to accept unquoted string or a data structure (encoded in JSON). This means, compared to just decoding from JSON, you don't have to always quote your string. But beware of traps like the bare values null, true, false becoming undef/1/0 in Perl instead of string literals, because they can be JSON-decoded.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Data-Sah-Filter-perl-Str-try_decode_json.

SOURCE

Source repository is at https://github.com/perlancar/perl-Data-Sah-Filter-perl-Str-try_decode_json.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah-Filter-perl-Str-try_decode_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) 2020 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.