This is my data structure
var someObject = {
'part1' : {
'name': 'Part 1',
'size': '20',
'qty' : '50'
},
'part2' : {
'name': 'Part 2',
'size': '15',
'qty' : '60'
},
'part3' : [
{
'name': 'Part 3A',
'size': '10',
'qty' : '20'
}, {
'name': 'Part 3B',
'size': '5',
'qty' : '20'
}, {
'name': 'Part 3C',
'size': '7.5',
'qty' : '20'
}
]
};
I want accessibility in this using this structure
var part1name = "part1.name";
var part2quantity = "part2.qty";
var part3name1 = "part3[0].name";
The value of someObject.part1.name, which is "Part 1," should be used as part1name. The part2quantity, which was filled with 60, is the same.
Is it possible to accomplish this with JQuery or just pure Javascript?