after researching A LOT I found myself in the to create a question here.
Usually I make an API call to a server and it returns like this
{
"codigo": 200,
"pessoas": [
{
"idpessoa": "5",
"idpessoa_legado": null,
"ativo": "S",
"ativo_painel": "S",
"ativo_login": "S",
"idpais": "3",
"idestado": "25",
"idcidade": "5370",
"documento": "12345678999"
}
]}
And whenever I need to call it up, I use a function like this:
user.set('documento', resp.pessoas[0].documento);
the "resp" part is a function that connects with the API. user.set sets the result to the new variable. It works fine as it should.
But I stumbled uppon an API that looks like this:
{
"510": {
"situacao": {
"idsituacao": "3",
"situacao": "Vendida"
},
"imobiliaria": {
"email": null,
"telefone": null,
"cnpj": null
},
"unidade": {
"empreendimento": "Artesano Galleria",
"idempreendimento_int": "19",
"etapa": "ETAPA 01",
...
I've never seen a json response without [] signs. This one has only {} signs. I have no idea on how to call it and get the value from 510.unidade.idempreendimento_int
Another problem is that it already starts with its own ID.
Help please! :)