import json
class Abc:
firstName = ''
secondName = ''
obj = Abc()
obj.firstName = 'Raj'
res = json.dumps(obj, default=lambda o: o.__dict__)
print(res)
Output: {"firstName": "Raj"}
But I need the Output like this
{"firstName": "Raj", "secondName": ""}
Any Solution for this??