Decode JSON encoded string to PHP variable constructs
category | Zend |
---|---|
package | Zend_Json |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
decode(string $source= null
, integer $objectDecodeType= \Zend_Json::TYPE_ARRAY
) : mixed
Decodes a JSON encoded string. The value returned will be one of the following:
By default, decoded objects will be returned as associative arrays; to return a StdClass object instead, pass Zend_Json::TYPE_OBJECT to the $objectDecodeType parameter.
Throws a Zend_Json_Exception if the source string is null.
static | |
---|---|
access | public |
string
String to be decoded
integer
How objects should be decoded; should be either or {@link Zend_Json::TYPE_ARRAY} or {@link Zend_Json::TYPE_OBJECT}; defaults to TYPE_ARRAY
\Zend_Json_Exception |
---|
mixed
decodeUnicodeString($chrs) : string
This algorithm was originally developed for the Solar Framework by Paul M. Jones
link | http://solarphp.com/ |
---|---|
link | http://svn.solarphp.com/core/trunk/Solar/Json.php |
string
__construct(string $source, integer $decodeType) : void
string
String source to decode
integer
How objects should be decoded -- see {@link Zend_Json::TYPE_ARRAY} and {@link Zend_Json::TYPE_OBJECT} for valid values
_decodeArray() : array
..,elementN]
array
_decodeObject() : array | \StdClass
..}
If Zend_Json_Encoder was used to encode the original object then a special attribute called __className which specifies a class name that should wrap the data contained within the encoded source.
Decodes to either an array or StdClass object, based on the value of \$_decodeType. If invalid $_decodeType present, returns as an array.
array
\StdClass
_decodeValue() : mixed
mixed
_eatWhitespace()
_getNextToken() : integer
integer
Token constant value specified in class definition_utf162utf8(string $utf16) : string
Normally should be handled by mb_convert_encoding, but provides a slower PHP-only method for installations that lack the multibye string extension.
This method is from the Solar Framework by Paul M. Jones
link | http://solarphp.com |
---|
string
UTF-16 character
string
UTF-8 character$_decodeType : integer
access | protected |
---|
$_offset : integer
$_source : string
$_sourceLength : integer
$_token : integer
COLON = 7
COMMA = 6
DATUM = 1
EOF = 0
LBRACE = 2
LBRACKET = 3
RBRACE = 4
RBRACKET = 5