0

I am a getting a FileContentResult from a web API for my desktop application.

{
    "fileContents": "JVBERi0xLjMNCjEgMCBvYmoNNzQ3Ng0KJSVFT0Y=",
    "contentType": "application/octet-stream",
    "fileDownloadName": "",
    "lastModified": null,
    "entityTag": null,
    "enableRangeProcessing": false
}

Need to know how the file can be downloaded?

I tried deserializing using Json.Net but it throws error 'Unknown object type! System.Byte'

kanmani24
  • 31
  • 5

1 Answers1

0

Instead of Json.Net I tried with Newtonsoft.Json, with below code I was able to download the file.

Dim fcr As System.Web.Mvc.FileContentResult
fcr = Newtonsoft.Json.JsonConvert.DeserializeObject(Of System.Web.Mvc.FileContentResult)(json_string)
File.WriteAllBytes("e:\test.pdf", fcr.FileContents)
kanmani24
  • 31
  • 5