1. 首页
  2. 数据库
  3. 其它
  4. 展平:在Python中展平JSON 源码

展平:在Python中展平JSON 源码

上传者: 2021-02-16 16:37:56上传 ZIP文件 12.68KB 热度 10次
flatten_json 在Python中展平JSON对象。 flatten_json平对象中的层次结构,如果要将对象强制放入表中,这很有用。 安装 pip install flatten_json 展平 用法 假设您有以下对象: dic = { "a" : 1 , "b" : 2 , "c" : [{ "d" : [ 2 , 3 , 4 ], "e" : [{ "f" : 1 , "g" : 2 }]}] } 您想要展平。 只需应用flatten : from flatten_json import flatten flatten ( dic ) 结果:
下载地址
用户评论