encode javascript function parameters as json