import datetime
import json
in_data = {}
in_data['2018']={'11': ['3', '4', '5', '10', '11', '17', '18', '24', '25'],
'10': ['6', '7', '13', '14', '20', '21', '27', '28'],
'12': ['1', '2', '8', '9', '15', '16', '22', '23', '29', '30', '31*'],
'1': ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '13', '14', '20', '21', '27', '28'],
'3': ['3', '4', '7*', '8', '10', '11', '17', '18', '24', '25', '31'],
'2': ['3', '4', '10', '11', '17', '18', '22*', '23', '24', '25'],
'5': ['1', '5', '6', '8*', '9', '12', '13', '19', '20', '26', '27'],
'4': ['1', '7', '8', '14', '15', '21', '22', '28', '29', '30*'],
'7': ['1', '7', '8', '14', '15', '21', '22', '28', '29'],
'6': ['2', '3', '9', '10', '11*', '12', '16', '17', '23', '24', '30'],
'9': ['1', '2', '8', '9', '15', '16', '22', '23', '29', '30'],
'8': ['4', '5', '11', '12', '18', '19', '25', '26']}
print(json.dumps(dict([[year,
dict([[month,
dict([[day,
{'isWorking':2}] for day in in_data[year][month]])
] for month in in_data[year]]
)] for x in in_data]
), indent=4, sort_keys=4
))
{
"2018": {
"1": {
"1": {
"isWorking": 2
},
"10": {
"isWorking": 2
},
"13": {
"isWorking": 2
},
"14": {
"isWorking": 2
},
"2": {
"isWorking": 2
},
"20": {
"isWorking": 2
},
"21": {
"isWorking": 2
},
"27": {
"isWorking": 2
},
"28": {
"isWorking": 2
},
"3": {
"isWorking": 2
},
"4": {
"isWorking": 2
},
"5": {
"isWorking": 2
},
"6": {
"isWorking": 2
},
"7": {
"isWorking": 2
},
"8": {
"isWorking": 2
},
"9": {
"isWorking": 2
}
},
"10": {
"13": {
"isWorking": 2
},
"14": {
"isWorking": 2
},
"20": {
"isWorking": 2
},
"21": {
"isWorking": 2
},
"27": {
"isWorking": 2
},
"28": {
"isWorking": 2
},
"6": {
"isWorking": 2
},
"7": {
"isWorking": 2
}
},
"11": {
"10": {
"isWorking": 2
},
"11": {
"isWorking": 2
},
"17": {
"isWorking": 2
},
"18": {
"isWorking": 2
},
"24": {
"isWorking": 2
},
"25": {
"isWorking": 2
},
"3": {
"isWorking": 2
},
"4": {
"isWorking": 2
},
"5": {
"isWorking": 2
}
},
"12": {
"1": {
"isWorking": 2
},
"15": {
"isWorking": 2
},
"16": {
"isWorking": 2
},
"2": {
"isWorking": 2
},
"22": {
"isWorking": 2
},
"23": {
"isWorking": 2
},
"29": {
"isWorking": 2
},
"30": {
"isWorking": 2
},
"31*": {
"isWorking": 2
},
"8": {
"isWorking": 2
},
"9": {
"isWorking": 2
}
},
"2": {
"10": {
"isWorking": 2
},
"11": {
"isWorking": 2
},
"17": {
"isWorking": 2
},
"18": {
"isWorking": 2
},
"22*": {
"isWorking": 2
},
"23": {
"isWorking": 2
},
"24": {
"isWorking": 2
},
"25": {
"isWorking": 2
},
"3": {
"isWorking": 2
},
"4": {
"isWorking": 2
}
},
"3": {
"10": {
"isWorking": 2
},
"11": {
"isWorking": 2
},
"17": {
"isWorking": 2
},
"18": {
"isWorking": 2
},
"24": {
"isWorking": 2
},
"25": {
"isWorking": 2
},
"3": {
"isWorking": 2
},
"31": {
"isWorking": 2
},
"4": {
"isWorking": 2
},
"7*": {
"isWorking": 2
},
"8": {
"isWorking": 2
}
},
"4": {
"1": {
"isWorking": 2
},
"14": {
"isWorking": 2
},
"15": {
"isWorking": 2
},
"21": {
"isWorking": 2
},
"22": {
"isWorking": 2
},
"28": {
"isWorking": 2
},
"29": {
"isWorking": 2
},
"30*": {
"isWorking": 2
},
"7": {
"isWorking": 2
},
"8": {
"isWorking": 2
}
},
"5": {
"1": {
"isWorking": 2
},
"12": {
"isWorking": 2
},
"13": {
"isWorking": 2
},
"19": {
"isWorking": 2
},
"20": {
"isWorking": 2
},
"26": {
"isWorking": 2
},
"27": {
"isWorking": 2
},
"5": {
"isWorking": 2
},
"6": {
"isWorking": 2
},
"8*": {
"isWorking": 2
},
"9": {
"isWorking": 2
}
},
"6": {
"10": {
"isWorking": 2
},
"11*": {
"isWorking": 2
},
"12": {
"isWorking": 2
},
"16": {
"isWorking": 2
},
"17": {
"isWorking": 2
},
"2": {
"isWorking": 2
},
"23": {
"isWorking": 2
},
"24": {
"isWorking": 2
},
"3": {
"isWorking": 2
},
"30": {
"isWorking": 2
},
"9": {
"isWorking": 2
}
},
"7": {
"1": {
"isWorking": 2
},
"14": {
"isWorking": 2
},
"15": {
"isWorking": 2
},
"21": {
"isWorking": 2
},
"22": {
"isWorking": 2
},
"28": {
"isWorking": 2
},
"29": {
"isWorking": 2
},
"7": {
"isWorking": 2
},
"8": {
"isWorking": 2
}
},
"8": {
"11": {
"isWorking": 2
},
"12": {
"isWorking": 2
},
"18": {
"isWorking": 2
},
"19": {
"isWorking": 2
},
"25": {
"isWorking": 2
},
"26": {
"isWorking": 2
},
"4": {
"isWorking": 2
},
"5": {
"isWorking": 2
}
},
"9": {
"1": {
"isWorking": 2
},
"15": {
"isWorking": 2
},
"16": {
"isWorking": 2
},
"2": {
"isWorking": 2
},
"22": {
"isWorking": 2
},
"23": {
"isWorking": 2
},
"29": {
"isWorking": 2
},
"30": {
"isWorking": 2
},
"8": {
"isWorking": 2
},
"9": {
"isWorking": 2
}
}
}
}