i working on data cleansing that fetched from mongo collection and exported as csv.
the data frame has only one column a huge nested json embbeded in each row iam trying to extract particular fields in that tried multiple ways nothing seems workout.
df : inputpayload
{
"action": "val1",
"action2": "val12",
"date": "12012",
"membership": [
{
"m1": "00",
"m2": "001",
"m3": "003",
"m4": "005",
"m5": "006",
"group": [
{
"g1": "a1",
"g2": "a2",
"g3": "a3",
"g4": "a4",
"g5": "a5",
"g6": "a6",
"g7": "a7",
"g9": "a10",
"data": [
{
"id": "xyz",
"code": "0012",
"fname": "abc",
"lname": "x",
"dob": "111280",
"sno": "234",
"bal": "2.3",
"cbal": "9.9"
}
]
}
]
}
]
}
fields to extract = ["id","code","fname","dob","sno","bal",""cbal"]
desired output data frame
id code fname dob sno bal cbal
xyz 0012 abc 111280 234 2.3 9.9
i want to do this in more pythonic way any solution/input will be highly appreciated.