Having data in below json format
{"A": {"Show only": ["Buy"], "Apple MacBook Product Line": ["MacBook Pro", "MacBook Air", "MacBook (Original)"], "Color": ["Space Gray", "Silver", "Gold", "Rose Gold", "Gray", "White", "Champagne Gold"], "Seller": ["Back Market", "Best Buy", "eBay"]}, "B": {"Show only": ["Buy"], "Material": ["Human Hair", "Synthetic"], "Features": ["Lace Front"], "Seller": ["arabellahair", "Ergode", "PartyBell.com"]}}
tried using below to convert this to csv format
import pandas as pd
import csv
import glob
for file in glob.glob('file.json'):
dfjson = pd.read_json(file,encoding='utf-8',lines= False, dtype=str)
dfjson.to_csv("output.csv",index = True)
But the expected output is
A Show only Buy
A Apple MacBook Product Line_001 MacBook Pro
A Apple MacBook Product Line_002 MacBook Air
A Apple MacBook Product Line_003 MacBook (Original)
A Color_001 Space Gray
A Color_002 Silver
A Color_003 Gold
A Color_004 Rose Gold
A Color_005 Gray
A Color_006 White
A Color_007 Champagne Gold
A Seller_001 Back Market
A Seller_002 Best Buy
A Seller_003 eBay
B Show only Buy
B Material_001 Human Hair
B Material_002 Synthetic
B Features Lace Front
B Seller_001 arabellahair
B Seller_002 Ergode
B Seller_003 PartyBell.com
What changes can be made to get this output