My json looks like below,
{
"customer_name":"john",
"phone":{
"mobile":000,
"office":111
},
"mail":{
"office":"[email protected]",
"personal":"[email protected]"
}
}
phone or mail can have 1 or many items. Also, the key (office, mobile, personnel) are not same always. For example, it can be Business or alternative. So I wanted to convert them to rows and not columns. Most of the questions are to convert to columns so not able to find a solution for rows.
The final data frame should look like,
customer_name | phone.key | phone.val | mail.key | mail.value
john | mobile | 000 | |
john | office | 111 | |
john | | | office | [email protected]
john | | | personal | [email protected]
Can someone help me?