1081. Class

1081.1. Zend\Json\Decoder

Decode JSON encoded string to PHP variable constructs

1081.1.1. Methods

1081.1.1.1. __construct

__construct()

Constructor

Parameters:
  • string – String source to decode
  • int – How objects should be decoded – see

{@link Zend_Json::TYPE_ARRAY} and {@link Zend_Json::TYPE_OBJECT} for valid values

throws InvalidArgumentException:
 
rtype:void

1081.1.1.2. decode

decode()

Decode a JSON source string

Decodes a JSON encoded string. The value returned will be one of the following:

  • integer
  • float
  • boolean
  • null
  • stdClass

  • array
    • array of one or more of the above types

By default, decoded objects will be returned as associative arrays; to return a stdClass object instead, pass {@link Zend_Json::TYPE_OBJECT} to the $objectDecodeType parameter.

Parameters:
  • string – String to be decoded
  • int – How objects should be decoded; should be

either or {@link Zend_Json::TYPE_ARRAY} or {@link Zend_Json::TYPE_OBJECT}; defaults to TYPE_ARRAY

rtype:mixed

1081.1.1.3. _decodeValue

_decodeValue()

Recursive driving routine for supported toplevel tops

Return type:mixed

1081.1.1.4. _decodeObject

_decodeObject()
Decodes an object of the form:
{ “attribute: value, “attribute2” : value,...}

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 {@link $decodeType}. If invalid $decodeType present, returns as an array.

Return type:array|stdClass
Throws :RuntimeException

1081.1.1.5. _decodeArray

_decodeArray()
Decodes a JSON array format:
[element, element2,...,elementN]
Return type:array
Throws :RuntimeException

1081.1.1.6. _eatWhitespace

_eatWhitespace()

Removes whitespace characters from the source input

1081.1.1.7. _getNextToken

_getNextToken()

Retrieves the next token from the source stream

Return type:int Token constant value specified in class definition
Throws :RuntimeException

1081.1.1.8. decodeUnicodeString

decodeUnicodeString()

Decode Unicode Characters from u0000 ASCII syntax.

This algorithm was originally developed for the Solar Framework by Paul M. Jones

Parameters:string
Return type:string

1081.1.1.9. _utf162utf8

_utf162utf8()

Convert a string from one UTF-16 char to one UTF-8 char.

Normally should be handled by mb_convert_encoding, but provides a slower PHP-only method for installations that lack the multibyte string extension.

This method is from the Solar Framework by Paul M. Jones

Parameters:string – UTF-16 character
Return type:string UTF-8 character

1081.1.2. Constants

1081.1.2.1. EOF

Parse tokens used to decode the JSON object. These are not for public consumption, they are just used internally to the class.

1081.1.2.2. DATUM

1081.1.2.3. LBRACE

1081.1.2.4. LBRACKET

1081.1.2.5. RBRACE

1081.1.2.6. RBRACKET

1081.1.2.7. COMMA

1081.1.2.8. COLON