Venus::Json - Json Class
Json Class for Perl 5
package main; use Venus::Json; my $json = Venus::Json->new( value => { name => ['Ready', 'Robot'], version => 0.12, stable => !!1, } ); # $json->encode;
This package provides methods for reading and writing JSON data. Note: This package requires that a suitable JSON is installed, currently either JSON::XS 3.0+, JSON::PP 2.27105+, or Cpanel::JSON::XS 4.09+.
JSON::XS
3.0+
JSON::PP
2.27105+
Cpanel::JSON::XS
4.09+
This package has the following attributes:
decoder(CodeRef)
This attribute is read-write, accepts (CodeRef) values, and is optional.
(CodeRef)
encoder(CodeRef)
This package inherits behaviors from:
Venus::Kind::Utility
This package integrates behaviors from:
Venus::Role::Accessible
Venus::Role::Explainable
This package provides the following methods:
decode(Str $json) (Any)
The decode method decodes the JSON string, sets the object value, and returns the decoded value.
Since 0.01
0.01
# given: synopsis; my $decode = $json->decode('{"codename":["Ready","Robot"],"stable":true}'); # { codename => ["Ready", "Robot"], stable => 1 }
encode() (Str)
The encode method encodes the objects value as a JSON string and returns the encoded string.
# given: synopsis; my $encode = $json->encode; # '{ "name": ["Ready", "Robot"], "stable": true, "version": 0.12 }'
Cpanery, cpanery@cpan.org
cpanery@cpan.org
Copyright (C) 2021, Cpanery
Read the "license" file.
To install Venus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Venus
CPAN shell
perl -MCPAN -e shell install Venus
For more information on module installation, please visit the detailed CPAN module installation guide.