Angad Singh Rajput
Angad Singh Rajput

Reputation: 19

File Download using Javascript / Angularjs, whose content is retrieved in JSON format

I have downloaded the file from a REST api, but its content is displayed in this format. I wish to download it instantaneously in the browser whenever it is called.

{"0":"�","1":"�","2":"�","3":"�","4":"\u0000","5":"\u0010","6":"J","7":"F","8":"I","9":"F","10":"\u0000","11":"\u0001","12":"\u0001","13":"\u0000","14":"\u0000","15":"\u0001","16":"\u0000","17":"\u0001","18":"\u0000","19":"\u0000","20":"�","21":"�","22":"\u0000","23":"C","24":"\u0000","25":"\b","26":"\u0006","27":"\u0006","28":"\u0007","29":"\u0006","30":"\u0005","31":"\b","32":"\u0007","33":"\u0007","34":"\u0007","35":"\t","36":"\t","37":"\b","38":"\n","39":"\f","40":"\u0014","41":"\r","42":"\f","43":"\u000b","44":"\u000b","45":"\f","46":"\u0019","47":"\u0012","48":"\u0013","49":"\u000f","50":"\u0014","51":"\u001d","52":"\u001a","53":"\u001f"}

Upvotes: 0

Views: 219

Answers (1)

Adrian B.
Adrian B.

Reputation: 1570

Use the browser's webdeveloper tools (F12 in Chrome, firebug in firefox, F12 or F10 in IE) and check the request you're making for the file. Check the content type and the format of the response. From what I'm seing, I think the "file" is recognized on the client side as a JavaScript array.

Also consider setting the encoding from server-side.

Upvotes: 0

Related Questions