I have an object which needs to be converted. I am trying to convert the object to FormData to upload a file
Object:
obj{
  a:
  { 
    a1: 'test1',
    a2: 'test2'
  }
  b:
  {
    b1: 'test3',
    c1: 'test4',
  }
}
Converted to:
{
  obj[a][a1]: test1,
  obj[a][a2]: test2,
  obj[b]: binarydata // I want to convet this to binary data 
}
What I have now which is not working:
const formData = new FormData()
Object.keys(object).forEach(key => formData.append(key, object[key]));
I am not trying to flatten array. I am trying to convert it to an object like
obj[key1][key2][..]: value
 
    