JSON - JSON (JavaScript Object Notation) encoder/decoder
简介:
use JSON; # imports encode_json, decode_json, to_json and from_json.
# simple and fast interfaces (expect/generate UTF-8)
$utf8_encoded_json_text = encode_json $perl_hash_or_arrayref;
$perl_hash_or_arrayref = decode_json $utf8_encoded_json_text;
# OO-interface
$json = JSON->new->allow_nonref;
$json_text = $json->encode( $perl_scalar );
$perl_scalar = $json->decode( $json_text );
$pretty_printed = $json->pretty->encode( $perl_scalar ); # pretty-printing
# If you want to use PP only support features, call with '-support_by_pp'
# When XS unsupported feature is enable, using PP (de|en)code instead of XS ones.
use JSON -support_by_pp;
# option-acc
perl json模块
最新推荐文章于 2023-12-11 20:00:06 发布