Skip to content

Instantly share code, notes, and snippets.

@Orbis25
Created April 26, 2021 18:46
Show Gist options
  • Save Orbis25/a1ec87bae5579500a6de4c5591523cda to your computer and use it in GitHub Desktop.
Save Orbis25/a1ec87bae5579500a6de4c5591523cda to your computer and use it in GitHub Desktop.
Convert html form to json.
/**
* Convert form to json
* @param {Event} event evento del formulario
*/
const FormToJson = async (event) => {
event.preventDefault();
const data = new FormData(event.target)
const values = Object.fromEntries(data.entries());
return values
}
@Orbis25
Copy link
Author

Orbis25 commented Apr 26, 2021

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment