Previous topic

Next topic

Basic Usage

Usage of Zend_Json involves using the two public static
methods available: Zend_Json::encode() and
Zend_Json::decode().

// Retrieve a value:

$phpNative = Zend_Json::decode($encodedValue);

// Encode it to return to the client:

$json = Zend_Json::encode($phpNative);

Pretty-printing JSON

Sometimes, it may be hard to explore JSON data generated by
Zend_Json::encode(), since it has no spacing or indentation.
In order to make it easier, Zend_Json allows you to pretty-print
JSON data in the human-readable format with
Zend_Json::prettyPrint().