I have a code to print the result in XML ,I need to print in json ,how can I do it using python
if format == 'XML':
output += '<spellcheck-result>\n'
for inputWord in corrections.keys():
output += '<word>\n'
result = {
True : 'CORRECT',
False : 'INCORRECT'
}[inputWord in corrections[inputWord].keys()]
output += '<source status=\"' + result + '\">' + inputWord + "</source>\n"
if result != 'CORRECT':
for correction in corrections[inputWord].keys():
output += '<correction module=\"' + corrections[inputWord][correction] + '\">' + correction + "</correction>\n"
output += '</word>\n'
output += '</spellcheck-result>'