Skip to content

Convert and output to json

aalbino edited this page Nov 21, 2010 · 1 revision

Convert and output to JSON

As per wikipedia, JSON is defined as: "JSON (an acronym for JavaScript Object Notation (pronounced /ˈdʒeɪsən/) is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript programming language for representing simple data structures and associative arrays, called objects. Despite its relationship to JavaScript, it is language-independent, with parsers available for virtually every programming language.[...]"

We accomplish converting our data using the Zend_Json static methods, Zend_Json::encode() and Zend_Json::decode.

The simplest use of JSON data encoding is found in our admin module's Orders controller, where data is returned to the client in JSON notation. See the /application/admin/controllers/OrdersController.php file for the jsonList() and jsonUpdate() actions.

Links

Clone this wiki locally