Test2:...::JSON(3pm)
β¨ NAME β¨
okay so this is Test2::Harness::Util::JSON (the page header calls it Test2:...::JSON(3pm), cute abbreviated moment π
) β it's a utility class that helps Test2::Harness pick the best JSON implementation to use. bestie, it's literally the vibe-checker for your JSON backend π
πΈ DESCRIPTION πΈ
This package hands you functions for encoding/decoding json, and it uses the best json tools that are available. no cap. it doesn't make you choose β it just picks the good one and slays π¦
π SYNOPSIS π
use Test2::Harness::Util::JSON qw/encode_json decode_json/;
my $data = { foo => 1 };
my $json = encode_json($data);
my $copy = decode_json($json);
so you import encode_json and decode_json, shove your data in, and get a string out. then you can turn that string back into data. it's giving round trip β¨
π EXPORTS π
here's everything you can pull into your namespace, one by one, no skips π«Ά
$package = JSON()β gives you back the JSON package thatyathis actually using. like, the real one. the main character π₯$bool = JSON_IS_PP()β true ifyathis usingJSON::PP.$bool = JSON_IS_XS()β true ifyathis usingJSON::XS.$bool = JSON_IS_CPANEL()β true ifyathis usingCpanel::JSON::XS.$bool = JSON_IS_CPANEL_OR_XS()β true if eitherJSON::XSorCpanel::JSON::XSare being used. either/or energy, we love to see it π$string = encode_json($data)β encodes data into json. the string will be 1-line. compact. efficient. lowkey neat π$data = decode_json($string)β decodes json data out of the string. turn that text back into vibes β$string = encode_pretty_json($data)β encodes into human-friendly json. pretty-printed, easy on the eyes, screenshot-worthy π$string = encode_canon_json($data)β encodes into canon-json. canonical, periodt π
π SOURCE π
the source code repository for Test2-Harness lives at http://github.com/Test-More/Test2-Harness/ β go peek, bestie, the receipts are all there π
π MAINTAINERS π
- Chad Granum
<exodist@cpan.org>
π AUTHORS π
- Chad Granum
<exodist@cpan.org>
π COPYRIGHT π
Copyright 2020 Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
ngl the licensing is short and sweet: same terms as Perl itself, fr fr. go read the link if you wanna know the details π
and that's the whole page, bestie π«Ά this was perl v5.40.1, dated 2026-05-10 β that's the version and date stamped on this little icon, so now you know exactly which era of energy you're working with. mwah πβ¨
π¦ where this page comes from
- ubuntu stonking: libtest2-harness-perl 1.000172-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms