I have the following structure in my json:
obj = {
'Name': 'David',
'Car': {
'Make': 'Ford',
'Year': 2008
}
}
I am given dot notation to refer to the object value, for example:
Car.Make ==> 'Form'
Given a string, such as "Car.Make"
, how would I programmatically fetch the attribute? In the above example, it would be:
obj.get('Car').get('Make')
But what about for a deeply-nested object, how would I extract the value given dot notation of "Attr1.Attr2.Attr3...Attrn"
?