json file to csv python code example

Example 1: json to csv python

import pandas as pd
df = pd.read_json (r'C:\Users\Ron\Desktop\Test\Product_List.json')
export_csv = df.to_csv (r'C:\Users\Ron\Desktop\Test\New_Products.csv', index = None, header=True)

Example 2: convert csv to json python

import pandas as pd
df = pd.read_csv (r'Path where the CSV file is saved\File Name.csv')
df.to_json (r'Path where the new JSON file will be stored\New File Name.json')