Home > Enterprise >  How to send a Map Object With FormData to .NET API?
How to send a Map Object With FormData to .NET API?

Time:04-15

When i try to send a map object with FormData its give an error like;

TS2345: Argument of type 'Map<number, number>' is not assignable to parameter of type 'string | Blob'.   Type 'Map<number, number>' is missing the following properties from type 'Blob': type, arrayBuffer, slice, stream, tex

How can i send this object with formdata to my .net API ?

CodePudding user response:

Convert to json and send like that.

CodePudding user response:

Convert to json and send like this

var content = '{ json data here }';
var blob = new Blob([content], { type: "text/json"});
formData.append("jsonData", blob);

OR

new Blob([JSON.stringify({
   description: 'description',
})], {
   type: 'application/json'
})
  • Related