Translating JSON Results to CSV

April 29, 2017 Contributors

If you’ve ever run the Metrics, Transmissions, or Message Events APIs, you’ve seen the results displayed in JSON like this:

So what is JSON and how do you translate it into a different format like a CSV file for further analysis?

# What Is JSON?

JSON stands for JavaScript Object Notation. It is a lightweight way to store and transfer data. It’s easy to read in it’s native format and easy to understand. You can read more about JSON at the w3schools.com website.

# Translating JSON to CSV Format

To translate the JSON results to a CSV file, you will need the help of a tool that can make the transformation. There are quite a few available for free on the internet, although some sites do want a small fee if the JSON is over a certain size. Simply put “json to csv” or “json to excel” into your favorite browser. One we have found to be particularly reliable is at https://json-csv.com/. You simply copy the JSON and paste it into the textbox on the site and it converts the raw JSON to a CSV format ready to download.

Of course if you are feeling adventurous, you can write your own JSON to CSV translator. One of the great things about JSON is that it can be parsed out using nothing more than javascript.

Happy Sending!