I have a csv file with multiple values in one cell like in this format:
ID, Name, Role, Task, Responsibility
123, Stephen, "1. Give, 2. Take", "1.1. DO, 1.2. AB, 2.1. DF", "1.1.1. FG, 1.1.2. GH, 1.2.1. SG, 2.1.1. DF, 2.1.2. JK"
I added some white space for readability. I need to convert this csv file into nested json format like:
{
"Name" : "Stephen",
"123": {
"1": {
"Role": "Give",
"1.1": {
"Task": "DO",
"1.1.1": {
"Responsibility": "FG"
},
"1.1.2": {
"Responsibility": "GH"
}
},
"1.2": {
"Task": "AB",
"1.2.1": {
"Responsibility": "SG"
}
}
},
"2": {
"Role": "Take",
"2.1": {
"Task": "DF",
"2.1.1": {
"Responsibility": "DF"
},
"2.1.2": {
"Responsibility": "JK"
}
}
}
}
}
and the numbers go like this 1, 1.1, 1.2.1, 2.2, 2.3, 2.3.1. I need a to detect such cells (or such type of columns) and convert it into the key:value pair like above.