Python json_normalize“非常感谢您提供的信息。我主要尝试使用“json_normalize”并始终在一行中得到结果非常感谢您提供的信息。我主要尝试使用“json_normalize”并始终在一行中得到结果 { "76010511&quo
Python json_normalize“非常感谢您提供的信息。我主要尝试使用“json_normalize”并始终在一行中得到结果非常感谢您提供的信息。我主要尝试使用“json_normalize”并始终在一行中得到结果 { "76010511&quo,python,json,pandas,Python,Json,Pandas,json_normalize“非常感谢您提供的信息。我主要尝试使用“json_normalize”并始终在一行中得到结果非常感谢您提供的信息。我主要尝试使用“json_normalize”并始终在一行中得到结果 { "76010511": { "task_id": "76010511", "parent_id": "0", "assigned_by"
json_normalize“非常感谢您提供的信息。我主要尝试使用“json_normalize”并始终在一行中得到结果非常感谢您提供的信息。我主要尝试使用“json_normalize”并始终在一行中得到结果
{
"76010511": {
"task_id": "76010511",
"parent_id": "0",
"assigned_by": "1796633",
"name": "praca",
"external_task_id": null,
"external_parent_id": null,
"level": "1",
"archived": "0",
"tags": "",
"budgeted": "0",
"budget_unit": "",
"root_group_id": "508916",
"billable": "1",
"note": null,
"public_hash": null,
"add_date": "2020-09-23 06:49:29",
"modify_time": null,
"color": "#68E3B1",
"users": {
"1796633": {
"user_id": "1796633",
"role_id": "1"
}
},
"user_access_type": 4
},
"76010692": {
"task_id": "76010692",
"parent_id": "0",
"assigned_by": "1796633",
"name": "nowe",
"external_task_id": null,
"external_parent_id": null,
"level": "1",
"archived": "0",
"tags": "",
"budgeted": "0",
"budget_unit": "",
"root_group_id": "508916",
"billable": "1",
"note": null,
"public_hash": null,
"add_date": "2020-09-23 07:29:05",
"modify_time": null,
"color": "#F9C947",
"users": {
"1796633": {
"user_id": "1796633",
"role_id": "1"
}
},
"user_access_type": 4
},
"76010693": {
"task_id": "76010693",
"parent_id": "0",
"assigned_by": "1796633",
"name": "inne",
"external_task_id": null,
"external_parent_id": null,
"level": "1",
"archived": "0",
"tags": "",
"budgeted": "0",
"budget_unit": "",
"root_group_id": "508916",
"billable": "1",
"note": null,
"public_hash": null,
"add_date": "2020-09-23 07:29:12",
"modify_time": null,
"color": "#725E5E",
"users": {
"1796633": {
"user_id": "1796633",
"role_id": "1"
}
},
"user_access_type": 4
}
}
with o.urlopen(json_link) as jfile_tc:
dane_tc_0 = json.load(jfile_tc)
dane_tc_all = json_normalize(dane_tc_0)
dane_tc_all
task_id;parent_id;assigned_by;name;external_task_id;external_parent_id;root_group_id;billable;note;public_hash;add_date;modify_time;user_access_type;user_id;role_id
76010511;0;1796633;praca;None;None;508916;1;None;None;23.09.2020;None;4;1796633;1
76010511;0;1796633;praca;None;None;508916;1;None;None;23.09.2020;None;4;1796631;2
import pandas as pd
df = pd.read_json(data)
new_df = df.transpose()
data = {'76010511': {'task_id': '76010511', 'parent_id': '0', 'assigned_by': '1796633', 'name': 'praca', 'external_task_id': 'null', 'external_parent_id': 'null', 'level': '1', 'archived': '0', 'tags': '', 'budgeted': '0', 'budget_unit': '', 'root_group_id': '508916', 'billable': '1', 'note': 'null', 'public_hash': 'null', 'add_date': '2020-09-23 06:49:29', 'modify_time': 'null', 'color': '#68E3B1', 'users': {'1796633': {'user_id': '1796633', 'role_id': '1'}}, 'user_access_type': 4}, '76010692': {'task_id': '76010692', 'parent_id': '0', 'assigned_by': '1796633', 'name': 'nowe', 'external_task_id': 'null', 'external_parent_id': 'null', 'level': '1', 'archived': '0', 'tags': '', 'budgeted': '0', 'budget_unit': '', 'root_group_id': '508916', 'billable': '1', 'note': 'null', 'public_hash': 'null', 'add_date': '2020-09-23 07:29:05', 'modify_time': 'null', 'color': '#F9C947', 'users': {'1796633': {'user_id': '1796633', 'role_id': '1'}}, 'user_access_type': 4}, '76010693': {'task_id': '76010693', 'parent_id': '0', 'assigned_by': '1796633', 'name': 'inne', 'external_task_id': 'null', 'external_parent_id': 'null', 'level': '1', 'archived': '0', 'tags': '', 'budgeted': '0', 'budget_unit': '', 'root_group_id': '508916', 'billable': '1', 'note': 'null', 'public_hash': 'null', 'add_date': '2020-09-23 07:29:12', 'modify_time': 'null', 'color': '#725E5E', 'users': {'1796633': {'user_id': '1796633', 'role_id': '1'}}, 'user_access_type': 4}}
import json
data = json.dumps(data)
import pandas as pd
pd.read_json('your_filename.json', orient='index').set_index('task_id')