In an action (at the controller), you can just do:
ac.done(data, 'json');
That will stringify the data structure, and add the proper headers.
If you want to do it manually, by executing an actual view for example. You can do this:
ac.http.addHeader('Content-Type', 'application/json; charset="utf-8"');
ac.done(data, {
view: {
name: 'api-json-view-whatever'
}
});
So, the result of the done call (will be a string), and it will be sent to the client side as "application/json".
Or maybe a jsonp response:
ac.http.addHeader('Content-Type', 'application/javascript; charset="utf-8"');
ac.done(cb+'('+JSON.stringify(data)+')');