I have below data in config.json:
{
"data1": [7, 8],
"data2": [2015, 2016],
"data3": [5, 10],
}
It has 3 list with length as 2 but it can have multiple list with n length. I have to read this data and then create a list of list which should have all the values just like set. So output should look like below:
[
[7, 2015, 5],
[7, 2015, 10],
[7, 2016, 5],
[7, 2016, 10],
[8, 2015, 5],
[8, 2015, 10],
[8, 2016, 5],
[8, 2016, 10]
]
json_data = open("config.json")
config = json.load(json_data)
json_data.close()
data_list = []
for be in config["data1"]:
for eof in config["data2"]:
for bd in config["data3"]:
data_list.append(bd)
How can I modify the data to have output like above?