-
-
Save Sohail05/e4f9e576f8cd6c988ed00eb480d35a24 to your computer and use it in GitHub Desktop.
FormData to json
This file contains hidden or 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
var form = document.querySelector("form") | |
var data = new FormData(form); | |
var obj = {}; | |
for (var x of data.entries()) { | |
console.log(x); | |
obj[x[0]] = x[1]; | |
} | |
console.log(obj) | |
console.log(JSON.stringify(obj)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment