rndme / download

file downloading using client-side javascript
MIT License
2.28k stars 417 forks source link

Unable to download JSON file properly #100

Closed zachcoss closed 1 year ago

zachcoss commented 3 years ago

When I pass a JSON object and application/json mime type, I get a file that only contains the text [object Object]. Can someone confirm? I parsed the JSON and the object displays properly in the console (Chrome) before being passed to the downloadjs function.

Thanks.

chekoopa commented 3 years ago

The input can be a String, Blob, or Typed Array of data, or via a dataURL representing the file's data as base64 or url-encoded string

Do you serialize your object before passing it as an input? Like, JSON.stringify. You can't put just a plain JSON, it would be implicitly casted with toString.

rndme commented 1 year ago

Yes, there's no single way to stringify all objects, so we don't try.