const formData = new FormData(); for (let key in form) { Array.isArray(form[key]) ? form[key].forEach(value => formData.append(key + '[]', value)) : formData.append(key, form[key]) ; }