I have a json column in a dataframe df, where i am trying to convert it into a nested json and save it as a txt file for clients:
dataframe df
"json":{"0":{"status":"Active","task_name":"transientAlertf9b8b69eb4b84bd597b3983566ffc538","schedule":"","owner":"","task_type":"FraudIncremental","created_date":"Tue, 08 Jan 2019 00:34:43 GMT","parameters":{"program":"abc","subject":"abc ","days_back":1,"last_run_status":"OK"},"category":"Alert","permission":"private","messaging_channels":[{"channel_type":"email","cc":"","recipients":[""],"bcc":""}],"tags":"Fraud"}}}
into a nested json and save into txt
{
"created_date": "Tue, 08 Jan 2019 00:34:43 GMT",
"schedule": "",
"parameters": {
"last_run_status": "OK",
"subject": "abc ",
"days_back": 1,
"program": "abc"
},
"status": "Active",
"permission": "private",
"task_type": "abc",
"tags": "Fraud",
"messaging_channels": [
{
"bcc": "",
"cc": "",
"channel_type": "email",
"recipients": [
""
]
}
],
"task_name": "transientAlertf9b8b69eb4b84bd597b3983566ffc538",
"category": "Alert",
"owner": ""
}
ANy thoughts? Thanks.
I have checked a few posts and they are not quite the same
Pandas DataFrame to Nested JSON Without Changing Data Structure