Zend Framework, dojo and Json
by faheem on July 27th, 2009
I have already written about json in one, actually some of my articles. Cool functionality can be achieved using json. Thanks to http://www.json.org, http://www.zend.com and http://www.dojotoolkit.org for providing easier solutions.
I’m not gonna talk what these three are all about, but instead share a little secret about these.
Json creation in dojo is as simple as this.
var arr = new Array(); arr[0] = "apple"; arr[1] = "ball"; arr[2] = "cat"; dojo.toJson(arr);
Using Zend to convert array into json took only one line of code.
Zend_Json::encode($arr);
And decoding- converting json to array, is as simple as this
Zend_Json::decode(json_string);
