• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/CPANInternal-159.1/JSON-PP-2.27203/lib/JSON/

Lines Matching +defs:new +defs:string

105     ($JSON ||= __PACKAGE__->new->utf8)->encode(@_);
110 ($JSON ||= __PACKAGE__->new->utf8)->decode(@_);
127 sub new {
328 "%s::TO_JSON method returned same object as was passed instead of a new one",
645 decode_error("malformed JSON string, neither array, object, number, string or atom");
692 decode_error("malformed JSON string, neither array, object, number, string or atom") unless $valid_start;
696 'JSON text must be an object or array (but found number, string, true, false or null,'
726 return string() if($ch eq '"' or ($singlequote and $ch eq "'"));
731 sub string {
801 decode_error('illegal backslash escape sequence in string');
812 decode_error("malformed UTF-8 character in JSON string");
828 decode_error('invalid character encountered while parsing JSON string');
837 decode_error("unexpected end of string while parsing JSON string");
873 decode_error("malformed JSON string, neither array, object, number, string or atom");
960 $k = ($allow_barekey and $ch ne '"' and $ch ne "'") ? bareKey() : string();
1045 decode_error("malformed JSON string, neither array, object, number, string or atom");
1138 return Math::BigInt->new($v);
1146 return Math::BigFloat->new($v);
1209 $mess = '(end of string)';
1305 ( $_[0]->{_incr_parser} ||= JSON::PP::IncrParser->new )->incr_parse( @_ );
1310 ( $_[0]->{_incr_parser} ||= JSON::PP::IncrParser->new )->incr_skip;
1315 ( $_[0]->{_incr_parser} ||= JSON::PP::IncrParser->new )->incr_reset;
1320 $_[0]->{_incr_parser} ||= JSON::PP::IncrParser->new;
1422 use constant INCR_M_STR => 1; # inside string
1432 sub new {
1486 return $obj ? $obj : undef; # $obj is an empty string, parsing was completed.
1618 $coder = JSON::PP->new->ascii->pretty->allow_nonref;
1669 level. (e.g. the string "2.0" doesn't suddenly become "2" just because
1690 Converts the given Perl data structure to a UTF-8 encoded, binary string.
1694 $json_text = JSON::PP->new->utf8->encode($perl_scalar)
1700 The opposite of C<encode_json>: expects an UTF-8 (binary) string and tries
1706 $perl_scalar = JSON::PP->new->utf8->decode($json_text)
1743 my $json = JSON::PP->new->utf8;
1744 my $json_text = CGI->new->param( 'json_data' );
1766 In this case, C<$unicode_json_text> is of course UNICODE string.
1792 Note that the resulted text is a UNICODE string but no problem to print it.
1794 # $perl_scalar contains $encoding encoded string values
1799 Or C<decode $encoding> all string values and C<encode_json>:
1802 # ... do it to each string values, then encode_json
1814 =head2 new
1816 $json = JSON::PP->new
1818 Rturns a new JSON::PP object that can be used to de/encode JSON
1826 my $json = JSON::PP->new->utf8->space_after->encode({a => [1,2]})
1846 JSON::PP->new->ascii(1)->encode([chr 0x10401])
1861 JSON::XS->new->latin1->encode (["\x{89}\x{abc}"]
1874 an UTF-8-encoded string. Please note that UTF-8-encoded strings do not contain any
1883 If $enable is false, then the encode method will return the JSON string as a (non-encoded)
1884 Unicode string, while decode expects thus a Unicode string. Any decoding or encoding
1890 $jsontext = encode "UTF-16BE", JSON::PP->new->encode ($object);
1895 $object = JSON::PP->new->decode (decode "UTF-32LE", $jsontext);
2036 non-reference into its corresponding string, number or null JSON value,
2045 JSON::PP->new->allow_nonref->encode ("Hello, World!")
2128 my $js = JSON::PP->new->filter_json_object (sub { 5 });
2170 ->new
2200 C<utf8::downgrade> to the returned string by C<encode>.
2219 given character in a string.
2237 is called on a string that is longer then this many bytes, it will not
2238 attempt to decode the string but throw an exception. This setting has no
2252 converted into JSON string or number sequences, while references to arrays
2278 JSON->new->decode_prefix ("[1] the tail")
2305 $json->incr_parse( [$string] ) # void context
2307 $obj_or_undef = $json->incr_parse( [$string] ) # scalar context
2309 @obj_or_empty = $json->incr_parse( [$string] ) # list context
2311 This is the central parsing function. It can both append new text and
2315 If C<$string> is given, then this string is appended to the already
2337 Example: Parse some JSON arrays/objects in a given string and return them.
2339 my @objs = JSON->new->incr_parse ("[5][7][1,2]");
2362 $string = $json->incr_text;
2363 $string =~ s/\s*,\s*//;
2364 $json->incr_text( $string );
2542 =item string
2544 A JSON string becomes a string scalar in Perl - Unicode codepoints in JSON
2545 are represented by the same codepoints in the Perl string, so no manual
2551 string scalar in perl, depending on its range and any fractional parts. On
2559 precision. Otherwise it will preserve the number as a string value (in
2561 re-encoded toa JSON string).
2659 JSON C<null> values, scalars that have last been used in a string context
2667 # used as string, so dump as string
2674 You can force the type to be a string by stringifying it:
2683 my $x = "3"; # some variable containing a string