数据加载、存储于文件格式:JSON数据

import json
from pandas import DataFrame

obj = """
{"orderBy":"default","orderWay":"desc","pageNo":1,"pageSize":15,"conditions":[{"name":"aaa","age":25,"pet":"zuko"},{"name":"bbb","age":30}],"filter":{"type":"mine","keywords":""}}
"""
# json.loads 将json字符串转换为python形式
result = json.loads(obj)
# json.dumps 将python对象转换成json格式
asjson = json.dumps(result)

# 将一组json对象转换为DataFrame
siblings = DataFrame(result['conditions'],columns=['name','age'])
print(siblings)
'''
  name  age
0  aaa   25
1  bbb   30
'''
posted @ 2021-02-20 15:34  OTAKU_nicole  阅读(77)  评论(0编辑  收藏  举报