Is possible send empty array by FormData? #5577
Answered
by
DigitalBrainJS
wildfrontend
asked this question in
Q&A
-
i use Automatic serialization to FormData to send empty array but it look like ignore empty value is automatic object serialization to a FormData object can send empty array? |
Beta Was this translation helpful? Give feedback.
Answered by
DigitalBrainJS
Mar 3, 2023
Replies: 1 comment
-
An empty array can't be represented in FormData as this is a flat data structure that only emulates data nesting, but you can send JSON string as a field value. await axios.postForm("http://localhost/", {
emptyArr: JSON.stringify([])
}); Unfortunately, at the moment server frameworks (like |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
wildfrontend
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
An empty array can't be represented in FormData as this is a flat data structure that only emulates data nesting, but you can send JSON string as a field value.
Unfortunately, at the moment server frameworks (like
multer
) do not support automatic deserialization as there is no established practice of serializing JSON into FormData fields, so you need to do it manually