Thursday, 17 January 2013

Zend Framework, dojo and Json | Zend Framework Tutorial pdf

Zend Framework, dojo and Json

I hav e already written about json in one, actually some of my articles.
Cool functionality can be achiev ed using json. Thanks to
http://www.json.org, http://www.zend.com and
http://www.dojotoolkit.org for prov ide 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 conv ert array into json took only one line of code.
Zend_Json::encode($arr);
And decoding- conv erting json to array , is as simple as this
Zend_Json::decode(json_string);

No comments: