how to pass json object in javascript function