formdata-json

1.0.0 • Public • Published

formdata-json

Converts FormData.entities() to JSON.

Install

npm i formdata-json --save-dev

Usage

/**
* Convert FormData elements to JSON
* @param {FormData} formData An object that is an instance of FormData 
*/

** Example **

const formDataJSON = require('formdata-json')

const formData = new FormData()
formData.set('name', 'James')
formData.set('username', 'JamesTheHacker')

const result = fromDataJSON(formData)

/* Results in: */
{
    name: 'James',
    username: 'JamesTheHacker')
}

Known Issues

  • WIP Does not support nested elements

Package Sidebar

Install

npm i formdata-json

Weekly Downloads

79

Version

1.0.0

License

ISC

Unpacked Size

4.89 kB

Total Files

5

Last publish

Collaborators

  • jamesthehacker