Last active
March 30, 2021 18:01
-
-
Save deyvicode/6197984457f7ea8decf6868be0f9fc76 to your computer and use it in GitHub Desktop.
Convert form data to a JSON object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const formDataToJson = form => { | |
let unindexed_array = form.serializeArray(); | |
let indexed_array = {}; | |
$.map(unindexed_array, (n, i) => { | |
indexed_array[n['name']] = n['value']; | |
}); | |
return indexed_array; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment