0
{
"success": {
"data": [
{
"IdContribuinte": "1",
"IdContribuinteTributario": "1",
"IdUsuarioAnalisando": null,
"DataAtualizacaoTributario": null,
"DataImportacao": "2018-01-12 14:09:26.507",
"Nivel": "0",
"Status": "AN",
"StatusDescricao": "ANALISAR",
"TipoPessoa": "J",
"TipoPessoaDescricao": "JURÍDICA",
"Nome": "PREFEITURA MUNICIPAL DE MARILIA",
"CpfCnpj": "44.477.909/0001-00",
"RgIe": null,
"DataNascimento": null,
"DataFalecimento": null,
"Falecido": "0",
"NomeMae": null,
"Cep": "17501-900",
"Endereco": "RUA BAHIA, 40 ",
"Logradouro": "RUA BAHIA",
"Numero": "40",
"Complemento": "",
"Bairro": "MARÍLIA",
"Cidade": "MARILIA",
"Uf": "SP",
"Telefone": "3402-6000",
"Email": null,
"UsuarioAnalisando": null
},
{
"IdContribuinte": "2",
"IdContribuinteTributario": "100000",
"IdUsuarioAnalisando": null,
"DataAtualizacaoTributario": null,
"DataImportacao": "2018-01-12 14:09:26.507",
"Nivel": "0",
"Status": "AN",
"StatusDescricao": "ANALISAR",
"TipoPessoa": "F",
"TipoPessoaDescricao": "FÍSICA",
"Nome": "JOSE ALVES FILHO",
"CpfCnpj": "791.910.028-34",
"RgIe": "9930556",
"DataNascimento": null,
"DataFalecimento": null,
"Falecido": "0",
"NomeMae": null,
"Cep": "17522-270",
"Endereco": "RUA EDUARDO PRADO, 279 ",
"Logradouro": "RUA EDUARDO PRADO",
"Numero": "279",
"Complemento": "",
"Bairro": null,
"Cidade": "MARILIA",
"Uf": "SP",
"Telefone": null,
"Email": null,
"UsuarioAnalisando": null
}
]
"feedback_msg" => "successo"
}
I want to access this json, I get it from a re-act prop,
const list = this.props.list || []
console.log(list.success.data[0].Nome)
but I’m not getting access
What’s being returned here:
console.log(list.success.data[0].Nome)
?– user41210
is returning this here Uncaught Typeerror: Cannot read Property 'data' of Undefined at Contribuinteslist.renderRows (app.js:40511) at Contribuinteslist.render (app.js:40553) at app.js:24050 at measureLifeCyclePerf (app.js:23329) at Reactcompositecomponentwrapper. _renderValidatedComponentWithoutOwnerOrContext (app.js:24049) at Reactcompositecomponentwrapper. _renderValidatedComponent (app.js:24076) at Reactcompositecomponentwrapper.performInitialMount (app.js:23616)
– Yuri Nassaro
If I use console.log(list.Success), it returns this below {data: Array(100), feedback_msg: null} data : Array(100) 0 : {Idcontributor: "1", Idcontributortax: "1", Idusuarioanalyzing: null, Dataupdateotributario: null, Dataimport: "2018-01-12 14:09:26.507", ... } 1 :
– Yuri Nassaro
And if you use
console.log(list.success.data)
?– user41210
tried ja, app.js:40511 Uncaught Typeerror: Cannot read Property 'data' of Undefined
– Yuri Nassaro
console.log(list)
gives what exactly ? You won’t be catching the[]
that comes from||
?– Isac
It’s my first question, so I get a little lost when it comes to digesting the codes, but my json is this one, which I move from the back end to the front $result = ['Success' => [ 'data' => $re-signageImovel, 'feedback_msg' => 'Contributor records for re-signage' ]];
– Yuri Nassaro
This JSON is invalid.
– Valdeir Psr
If you control the backend and have the code that generates JSON put it also in the question because it is relevant. Just as @Valdeirpsr indicated, the JSON you have in the question is invalid, so the problem starts there
– Isac
i’m getting it normal on the front, I access, this.props.list.Success it functiona, if I put . date it doesn’t work
– Yuri Nassaro