My question is relatively simple: How do I recursively set object attributes matching the key-value pairs of a dictionary?
For example, given this dict:
my_dict = {
"number": 0,
"thing": True,
"foo": {
"bar": {
"thing": "string"
}
}
}
I want to make an object with its keys as attributes, recursively:
>>> my_obj = some_method(my_dict)
>>> my_obj.number
0
>>> my_obj.foo.bar
{"thing": "string"}
>>> my_obj.foo.bar.thing
"string"