When you use the spread operator (...
) on a FormData
iterable, it converts the iterable into an array of key-value
pairs which is called (entries)
. You can then use Object.fromEntries()
to transform these entries into a plain object.
const myForm = new FormData()
myForm.set("name", "Ram")
const myFormDataObj = Object.fromEntries([...myForm])
console.log(myFormDataObj) // Output: { name: "Ram" }