Encode a set of form elements as a JSON object for manipulation/submission.