I have a controller that sends me information to download a file, it currently sent the one json
that way
public JsonResult GetXML(DownloadModel model)
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, byte[]> d = new Dictionary<string, byte[]>();
if (getXML.GetXMLComprobante(datosXML, out respuestaXML))
{
byte[] archivoPDF = Convert.FromBase64String(respuestaXML.XMLB64);
d.Add("pdf", archivoPDF);
return Json(serializer.Serialize(d));
}
}
and my problem comes when i want to add the file name
d.Add("nombre", "documento-de-prueba.pfd");
and in this case I would have to declare another dictionary to send it and I don't like this way of having to add more dictionaries to send multiple data anymore.
Is there any other way to send the Json
?
Let's see, I hope this example will give you new ideas :D
Model
Controller
View
The call outputs in the format
JSON
: