Aug-12-2022, 02:08 PM
(Aug-12-2022, 01:29 PM)snippsat Wrote: Try.
import json import pandas as pd import os path_to_json ='C://JsonFiles//' def file_path(path_to_json): json_files = [path_to_json + pos_json for pos_json in os.listdir(path_to_json) if pos_json.endswith('.json')] return json_files df = pd.DataFrame() for jf in file_path(path_to_json): with open(jf,'r') as f: data = json.loads(f.read()) # Flatten data df_nested_list = pd.json_normalize( data, record_path =['attributes'], meta=['ORDERNUMBER', 'PRODUCTCODE']) df = df.append(df_nested_list)
Hi snippsat
It does not load the desired data. I have attached the screen shot what I am looking for and the result from new code