form-data-to-object
v0.2.0
Published
Converts application/x-www-form-urlencoded keys to plain JS object
Downloads
68,012
Maintainers
Readme
form-data-to-object
Converts application/x-www-form-urlencoded data structure to plain JS object
API
formData.toObj()
- Converts keys in x-www-form-urlencoded format on an object to a normal objectformData.fromObj()
- Converts a normal object to object with keys in x-www-form-urlencoded format
// keys in x-www-form-urlencoded format
{
'foo': 'bar',
'foo2[name]': 'bar2',
'foo3[0]': 'bar3',
'foo3[1][name]': 'bar4'
}
// converts from/to
// normal object
{
foo: 'bar',
foo2: {
name: 'bar2'
},
foo3: ['bar3', {
name: 'bar4'
}]
}