I have a class like that:
class Payload(object):
def __init__(self, payload__):
self.__dict__ = json.loads(payload__)
I can read the JSON payloads like that:
json = Payload('{"Test1":"Test2","Test3":{"Test4":true}}')
So I can access the value of Test
like that:
print(json.Test1) # result: Test2
but I can't access the value of Test4
which is a sub of Test3
print(json.Test3.Test4) #result: AttributeError: 'dict' object has no attribute 'Test4'
So, the error is AttributeError: 'dict' object has no attribute 'Test4'
Any help would be appreciated.
Thanks!