object-to-formdata
object-to-formdata copied to clipboard
Not supported the nested objects
I have tried to convert the nested object to formData with serialize
let object = { key1: "VALUE1", key2: { nestedKey1: "NESTED_VALUE1" } }
but it is not support this case ==(
Can you provide a more thorough code example? The tests are passing for this case.
I have the same issue.
The library doesn’t allow to send nested objects. For example, instead of
{ data: { user: 1 } }
it sends { data[user]: 1 }
where 'data[user]'
is a solid string key.
The same for files, backend (KoaJS) have to do dirty hacks like files['documents[]']
Also, it doesn’t allow to send boolean values. Instead of real true or false, it sends strings, e.g. 'true'.
I use 4.4.2
version.
Looks like you had the same issues, for example https://github.com/therealparmesh/object-to-formdata/issues/187
Also, it doesn’t allow to send boolean values. Instead of real true or false, it sends strings, e.g. 'true'.
That's because FormData values can only be strings or Blobs. https://developer.mozilla.org/en-US/docs/Web/API/FormData/append
Thank you a lot