I have the following json
{
"error": false,
"installments": {
"visa": [{
"quantity": 1,
"installmentAmount": 500.00,
"totalAmount": 500.00,
"interestFree": true
}, {
"quantity": 2,
"installmentAmount": 261.28,
"totalAmount": 522.55,
"interestFree": false
}]
}
}
This object aims, can be changed depending on the call but only this object, can come as bradesco, itau, etc.
Is there a way to access the information for this object other than by its explicit name (installments.visa)?
Somehow play on a variable like this:
var cartao = installments.(truquemagico);
And access the data like this:
console.log(cartao[0].totalAmount);