Test2::Harness::Util::JSON - Utility class to help Test2::Harness pick the best JSON implementation.
This package provides functions for encoding/decoding json, and uses the best json tools available.
use Test2::Harness::Util::JSON qw/encode_json decode_json/; my $data = { foo => 1 }; my $json = encode_json($data); my $copy = decode_json($json);
This returns the JSON package being used by yath.
True if yath is using JSON::PP.
True if yath is using JSON::XS.
True if yath is using Cpanel::JSON::XS.
True if either JSON::XS or Cpanel::JSON::XS are being used.
Encode data into json. String will be 1-line.
Decode json data from the string.
Encode into human-friendly json.
Encode into canon-json.
The source code repository for Test2-Harness can be found at http://github.com/Test-More/Test2-Harness/.
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/
To install Test2::Harness, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test2::Harness
CPAN shell
perl -MCPAN -e shell install Test2::Harness
For more information on module installation, please visit the detailed CPAN module installation guide.