I've been on the lookout, but I just can't seem to find a solution that works for me.
So, here's the situation: I have an http
post service where I receive responses in object format. My code currently looks like this:
data.subscribe(data => {
let results;
this.results = data;
this.processResults(this.results);
}
processResults(obj: Object) {
console.log(obj);
// Here's the challenge - I need to extract the value stored in resultCodeConstant from the object. I attempted using functions like filter and find, but kept running into errors stating that it doesn't exist on type Object
// let item = obj.filter(element.name == 'resultCodeConstant')
}
The response I get from the http subscribe call looks something like this within the 'obj' variable:
{
authorizationToken: "qTYLf6f...",
secretQuestionId: null,
secretQuestionSentence: null,
resultCodeConstant: "AUTHORIZED",
userAccountState: "active",
…
}
Is there a way for me to specifically target and retrieve the value I need from this result? Do I need to implement some kind of loop?