I have the following (snippet) variable:
var txt = {
'start': {
'name':'Call start',
'data': {'next':'start/e3fe40'},
'id':'start',
'type':'standard---start'
},
'e3fe40': {
'name':'Menu',
'data': {'next':'end/asd3rg'},
'id':'e3fe40'
}
};
I need to parse through the JSON and get info from the 'e3fe40' branch (without knowing how its going to be called.
Here's what I have:
var nxt = txt.start.data.next.substr(6,10); <-- works
console.log(nxt); <-- works
console.log(txt.start.data.next); <-- works
console.log(txt.nxt.name); <-- nxt should contain 'e3fe40'
So, how do I go down a branch? txt.nxt.name won't work, txt.{nxt}.name won't work, etc....
Thanks, Dan
[ ]operator.