rndme/download

Unable to download JSON file properly

Closed this issue · 2 comments

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.

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

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