Serializes form data into an object.