Converts form values to a structured JSON object
Source: https://github.com/serbanghita/formToObject.js/blob/master/formToObject.js