NAME
Venus::Json - Json Class
ABSTRACT
Json Class for Perl 5
SYNOPSIS
package main;
use Venus::Json;
my $json = Venus::Json->new(
value => { name => ['Ready', 'Robot'], version => 0.12, stable => !!1, }
);
# $json->encode;
DESCRIPTION
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+
.
ATTRIBUTES
This package has the following attributes:
decoder
decoder(CodeRef)
This attribute is read-write, accepts (CodeRef)
values, and is optional.
encoder
encoder(CodeRef)
This attribute is read-write, accepts (CodeRef)
values, and is optional.
INHERITS
This package inherits behaviors from:
INTEGRATES
This package integrates behaviors from:
METHODS
This package provides the following methods:
decode
decode(Str $json) (Any)
The decode method decodes the JSON string, sets the object value, and returns the decoded value.
Since 0.01
- decode example 1
-
# given: synopsis; my $decode = $json->decode('{"codename":["Ready","Robot"],"stable":true}'); # { codename => ["Ready", "Robot"], stable => 1 }
encode
encode() (Str)
The encode method encodes the objects value as a JSON string and returns the encoded string.
Since 0.01