Hello,

I'm working on project that is planned to heavily rely on data
exchange with JSON. Here is an exemplary ajax call that posts JSON
data to Cake's controller (code is in the view):

$.ajax({"url": "/project/Controller/action
   "data": JSON.stringify($(this).serializeArray()),
   "type": "POST",
   "processData": false,
   "contentType": "application/json",
   "cache": false,
   "dataType": "json",
   "accepts": "json",
});

Data is posted and decoded in beforeFilter callback of controller
(RequestHandler makes this atuomatically). Data in controller action
looks in this way:

Array
(
    [0] => Array
        (
            [name] => data[Status][id]
            [value] => 48
        )

)

I'm wondering what is the best way to convert this data to Cake'
"native" data array to be compatible for $this->Model->save($data),
i.e:

Array
        (
            [Status] =>
                   Array
                          (
                            [id] => 48
                          )
        )

Regards,
Niki

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to