I love developing usable and rich web applications using the latest techniques available.

Using JSON in CakePHP 1.2

May 8th 2008 – Controller::$beforeFilter has been deprecated a while ago, i’ve updated the example using Controller::beforeFilter()

Almost an half year ago I created jsonComponent for CakePHP, since then it has been used by quite a few people including myself.

About 3 months ago I started developing with CakePHP 1.2, one of the projects I’m working on is Pagebakery. Pagebakery relies heavily on AJAX and JSON and it’s therefore a perfect opportunity to experiment with CakePHP’s new features.

One of those features is Router::parseExtensions(). ParseExtensions allows you to parse the extension in your request and let Cake select alternate layouts and views automatically.
Another feature I found is JavascriptHelper::object(), this method is also available in CakePHP 1.1 but I only stumbled on it recently. It’s build-in JSON support in CakePHP, we no longer need the jsonComponent!

I’m going to explain you how to setup CakePHP 1.2 to output JSON with help of Router::parseExtensions() and the JavascriptHelper::object() method.
Read the full article

05/06/2007 at 12:48 pm — Comments (53)

Securing your JSON II

A few weeks ago I posted something about securing your JSON. Since then Joe Walker has been looking into a few solutions. He posted the following three:

  1. Use a Secret in the Request
  2. Force pre-eval() Processing
  3. Force POST requests

More information about this issue:
Security for GWT applications
Shaping the future of secure Ajax mashups

06/04/2007 at 3:25 pm — Comments (0)

Securing your JSON

I stumbled on this post some time ago and since I’m using JSON more and more these days it’s not a bad idea being carefull. Bas Wenneker also was in the same position and he posted some ideas on securing your JSON.

I’m using JSON for almost anything so I was shocked a bit by his findings. Sleepless nights went by and then I thought of a counter hack so one could secure his JSON again.

14/03/2007 at 11:36 pm — Comments (1)