I am reading a JSON object using Python. Below is the example.
var name = jsonObj['f_name']; I want to define a function which can be directly called from jsonObj. Below is the pseudo code.
def get_attribute(key): if key in this return this[key] else return '' And then I want to use this function as shown below.
jsonObj.get_attribute('f_name') Let me know if this is possible. Please guide me on achieving this.
dictwhich is meant to be used as a Map, not an object with methods