You need to stringify your data first:
fd.append("key", JSON.stringify(["a","b","c"]));
And then when you want to retrieve the data parse it back into an array. This can be done manually using JSON.parse(), or, if you're using express, can be done for you by using the JSON/urlencoded body-parser middleware.
Explanation:
When you use .append(), the data passed as a second argument will be converted into a string. In the case of an array, the .toString() method gets called which joins the elements inside your array by a comma
a,b,c
This isn't good as this cannot be parsed back into the array easily, especially when you have complex arrays such as an array of objects or a multi-dimensional array.
However, as @Phil pointed out, you can manage this by using JSON.stringify on your input array. This way, you're providing a JSON string, which can easily be parsed back into data using JSON.parse()
"[\"a\",\"b\",\"c\"]" // <-- can be parsed into an array using JSON.parse()
See working example below:
var fd = new FormData();
fd.append("key", JSON.stringify(["a","b","c"]));
var str_arr = fd.get("key");
console.log(str_arr); // string format
console.log(JSON.parse(str_arr)); // array format
a,b,c" 👈 that's becauseFormDataonly accepts string orBlobvalues (see developer.mozilla.org/en-US/docs/Web/API/FormData/…) so the array is being converted to a string. It's unclear what you want the value to actually be