Convert json exports to csv outputs

Hello Everyone,

I just wanted to share a code snippet to convert export from json to csv using pandas. Please ensure pandas is installed on your machine using pip install pandas. I hope you find it useful!

import pandas as pd

"""
Converts labelbox export to csv file using pandas.
jsn_file: is the file path to json export output.
csv_file: is the file path that would like to output to.

Returns the csv output.
"""
def jsn_to_csv(jsn_file, csv_file):
    df = pd.read_json(jsn_file)
    df.to_csv(csv_file, index=False)
    return df

jsn_to_csv(jsn_file="", csv_file="")
1 Like