Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

Timeline for Convert JS Object to form data

Current License: CC BY-SA 4.0

10 events
when toggle format what by license comment
Apr 15, 2024 at 11:58 comment added gre_gor @foobarbecue Axios is a well known HTTP client. I don't think it needs introduction. And it can also use FormData, so I wouldn't say it doesn't concert Axios either.
Jan 2, 2023 at 3:28 comment added foobarbecue What is Axios? This thing I guess? axios-http.com/docs/intro Would be good to introduce it a bit in the answer since the question doesn't concern Axios.
Oct 22, 2022 at 16:55 history edited Ben Carp CC BY-SA 4.0
Axios now supports automatic serialization to FormData
Apr 20, 2022 at 12:40 comment added shamaseen better add FileList to the FormDataPrimitive types. and change the data type in getFormData to FromDataNest
Apr 20, 2022 at 12:29 comment added shamaseen wonderful solution, I'd recommend changing the Array part to: let obj: FormDataNest = {}; obj[index] = el; buildFormData(formData, obj, parentKey) as you need to append the index too in the array, not flatten it instead.
Apr 17, 2021 at 10:00 history edited Ben Carp CC BY-SA 4.0
added 6 characters in body
Apr 1, 2021 at 17:58 history edited Ben Carp CC BY-SA 4.0
deleted 386 characters in body
Oct 25, 2020 at 20:47 comment added Julian Gonggrijp I like the solution, but I'd recommend starting with if (isNil(data)) return because typeof null === 'object'.
Oct 25, 2020 at 19:40 history edited Ben Carp CC BY-SA 4.0
added 10 characters in body
Oct 25, 2020 at 19:25 history answered Ben Carp CC BY-SA 4.0