I have a JavaScript object as shown below.
{
"28903218": {
"type": "group",
"prompt": "Cool, thanks! Now tell us about your child's day:",
"description": ""
},
"37742463": {
"type": "choice",
"prompt": "How does {{answer_28903220}} react in an unwelcome situation?",
"description": "(Such as not wanting to be in the car seat, when you're not in the room at bedtime, etc.)"
},
"30035493": {
"type": "choice",
"prompt": "Friday:",
"description": ""
},
}
I have a problem to read it. How can I get the 28903218
property's value?
surveyData.getQuestions().subscribe(
result => {
//here I need to get the "28903218" object's value
},
err => { },
() => { }
);
Assuming that you know 28903218
:
var value = result["28903218"];
If you don't know it then you could loop through the properties until you find the desired one:
for (var prop in result) {
var value = result[prop];
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments