My data with multiple pages looks like this I want to convert it to a JSON file like below.
{
"Name" : "A",
{
"Project" : "P1",
{
[
"T1" : "P1.com",
]
},
"Project" : "P2",
{
[
"T2" : "P2.com",
"T3" : "P2.com",
]
}
},
"Name" : "B",
{
"Project" : "Q1",
{
[
"T1" : "Q1.com",
]
},
"Project" : "Q2",
{
[
"T2" : "Q2.com"
]
}
},
"Name" : "C",
{
"Project" : "R1",
{
[
"T1" : "R1.com",
]
},
"Project" : "R2",
{
[
"T2" : "R2.com"
]
}
}
}
This is the first time i'm working on json files and bit confused how to make the excel's heading as key and remaining datas as values. I am able to read the excel file using pandas. Can anyone help me with the idea to do this?
import json
import pandas as pd
df = pd.read_excel (r'D:\example.xlsx', sheet_name='Sheet1')
Names = df["Name"]
d = {}
for index, name in enumerate(Names):
I have tried reading the file.Since im working with JSON files for the first time i don't have much idea about how to convert this,
to_jsonmethod, see the docs