0

Zend Framework, dojo and Json

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);
Filed in: Dojo, JSON, Zend Framewrork Tags: ,

Leave a Reply

Submit Comment

© 8905 Faheem Abbas. All rights reserved. XHTML / CSS Valid.
Proudly designed by Theme Junkie.
Top Footer