-
-
Notifications
You must be signed in to change notification settings - Fork 43
Description
After long research, this dotMap module is a lifesaver for me, in my project. Because all other JSON serialize modules end with an error during accessing values especially with multiprocessing call. This module is worth using.
I am facing the below issue with dotMap, could you please help?
address = {'city': 'abc', 'country': 'XY', 'CountryCode': 101}
m = DotMap(address)
print(m.city)
print(m.CountryCode)
print(m.zipCode)
Output:
abc
101
DotMap()
In our input JSON, based on need only we will pass somedata(like zipCode), to reduce the load in the payload. But in my back end, in a generic way, we accessing values by doing the null check.
print(m.zipCode) if m.zipCode != ''
but, dotMap is passing 'DotMap()' string if accessing value is not there. How do I fix this? i need to pass it as empty string (''), if the accessing value not there in the dictionary. Appriciate your help on this.