\Zend_Json_Decoder
Decode JSON encoded string to PHP variable constructs
- Copyright: Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- License: http://framework.zend.com/license/new-bsd New BSD License
Synopsis
class Zend_Json_Decoder
{
- // constants
- const EOF = 0;
- const DATUM = 1;
- const LBRACE = 2;
- const LBRACKET = 3;
- const RBRACE = 4;
- const RBRACKET = 5;
- const COMMA = 6;
- const COLON = 7;
- // members
- protected $_source;
- protected $_sourceLength;
- protected $_offset;
- protected $_token;
- protected $_decodeType;
- // methods
- protected void __construct()
- public static mixed decode()
- protected mixed _decodeValue()
- protected array|StdClass _decodeObject()
- protected array _decodeArray()
- protected void _eatWhitespace()
- protected int _getNextToken()
Constants
Name | Value |
---|---|
EOF | 0 |
DATUM | 1 |
LBRACE | 2 |
LBRACKET | 3 |
RBRACE | 4 |
RBRACKET | 5 |
COMMA | 6 |
COLON | 7 |
Members
protected
- $_decodeType
—
int
Flag indicating how objects should be decoded - $_offset
—
int
The offset within the souce being decoded - $_source
—
string
Use to maintain a "pointer" to the source being decoded - $_sourceLength
—
int
Caches the source length - $_token
—
int
The current token being considered in the parser cycle
Methods
protected
- __construct() — Constructor
- _decodeArray() — Decodes a JSON array format: [element, element2,...,elementN]
- _decodeObject() — Decodes an object of the form: { "attribute: value, "attribute2" : value,...}
- _decodeValue() — Recursive driving rountine for supported toplevel tops
- _eatWhitespace() — Removes whitepsace characters from the source input
- _getNextToken() — Retrieves the next token from the source stream
public
- decode() — Decode a JSON source string