I think the if($param == "constraints") probably is unnecessary but I'm a little unsure. I guess the real problem is Zend_Json::encode() but I have no experience of how it works and this fix works although it's not the prettiest