How to convert a CSV to JSON

I have recently started using the iOS’s Shortcuts and while trying to do more I have also started to use other apps such as:

For simplicity I store some of the data that I collect on my Shortcuts in CSV format and while looking for an easy way to convert that data into a Charty graph I have found this great post in the Coders Zine that solved my problem instantly.

Now, with the code below I can output a dictionary from the Scriptable inline action. The dictionary can then be used directly in the Charty actions to create a graph.

Note: Charty has an action to read from a CSV file but in this case I wanted to be able to work with the dictionary before plotting the chart.

Keep coding!

1 Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.