# -*- coding: utf-8 -*-
"""
Created on Thu Nov 18 21:46:56 2021
@author: michaelxwang
"""
import json
from pandas import json_normalize
filename='./xxx_json.txt'
#打开存储json的文件
with open(filename, 'r',encoding='utf8') as file_to_read:
data = file_to_read.read()
#load json
result_json = json.loads(data)
#格式化
dat_table = json_normalize(result_json)
#导出excel
dat_table.to_excel('./xxx.xlsx',index = False)
网友评论