Reviews by makamaka


JSON (2.51)

Because I saw Ben Bullock's terrible review, I comment a bit.

The how-to of (de|en)code_json, (from|to)_json and object methods
are described in the document (each sections and SYNOPSIS).
decode_json expects an UTF-8 (binary) string and identical to:

JSON->new->utf8->decode( $utf8_encoded_text )

So when you correctly use Encode::encode, the below code works.

# $string is a string (or UNICODE)

decode_json( encode('utf8', $string ) );

If decode_json croaks, it's your wrong use of Encode method.
That is not because of the JSON interface difficulty.

from_json is identical to:

JSON->new->decode( $scalar );

# from_json( $scalar, { allow_nonref => 1 } );

# => JSON->new->allow_nonref->decode( $scalar );

So from_json() can take a non utf8 encoded string.

Please see to
Encode, perluniintro,

JSON-PP (2.27103)

Hi, Taro Nishino.
Yes, I was perhaps the first to transplant json to Perl as you said.
I appreciate your hearty review!