nox7 / form-data-json-converter

Simple (extendable) FormData -> JSON converter. Works on files for binary-safe base64 conversion.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FormDataJSON Class

Simple (extendable) FormData -> JSON converter. Works on files for binary-safe base64 conversion.

Example Usage

import FormDataJSON from "./form-data-json.js";

const form = document.querySelector("form");
form.addEventListener("submit", async e => {
	e.preventDefault();

	const fData = new FormData(form);
	const fDataJSON = new FormDataJSON(fData);
	let jsonRep = await fDataJSON.getAsJSON();

	console.log(jsonRep);
})

About

Simple (extendable) FormData -> JSON converter. Works on files for binary-safe base64 conversion.

License:MIT License


Languages

Language:JavaScript 100.0%