I’ve just spent a few hours trying to work out exactly how I can convert a JSON array into a CSV file which the user can save to their phone. The use case for this scenario is as follows:
- User opens App
- App displays results from a noSQL database as an ion-list
- User wishes to save this data as a CSV, thereofre clicks the “Download to CSV” button
- App generates CSV file and saves it in the “Downloads” directory of the phone
I assumed this would be a reasonably common scenario, however I have been unable to find any sample code online. I’ve searched the Ionic forums and found a few people asking the same question for Ionic 1, but none of these had solid answers and it didn’t seem like anyone else has asked the question for Ionic 2.
Do I need to use Native plugins like the File Plugin? I’m finding the documentation there a bit ‘thin’ to follow.
Does anyone have a working example of the functionality I require?