serialize a form to json object