PHP json_encode encode a function
Viola i solved my problem with Zend_JSON encoder
$options = array(
'title' => 'Title',
'fnCallback' => new Zend_Json_Expr('someCallback')
);
Zend_Json::encode(
$options,
false,
array('enableJsonExprFinder' => true));
JSON is for passing values around, they are not suitable for passing pieces of code.
You can, instead, pass a function name or other meaningful value and retrieve the right function to call from it on the JavaScript side.