0
I need to access a json object as if it were an array, Example I have the following object on the client side:
´ remessa : function (){
var arr2 = [{
'NrSequenciaDoc' : '7777',
'TipoOcorrencia' : '1',
'NossoNumero' : '66688',
'NumeroDocumento' : '6987',
'DataVencimento' : '30082017',
'SacadoUF' : 'UF', },
{
'NrSequenciaDoc' : '7777',
'TipoOcorrencia' : '1',
'NossoNumero' : '66690',
'NumeroDocumento' : '6987',
'DataVencimento' : '30082017',
'SacadoUF' : 'UF', }];
axios({
method: 'post',
url: '/server/remessa',
params: {
Nrbanco : '085',
TipoInscricao : '1',
IncricaoCedente : '06624079975',
...
Detalhe : arr2
...
,
}
}).then(function (response)
{
console.log('response.data' + response.data)
}).catch(function (error) {
console.log(error)
})
}
and on the server and have `var arr = req.query.Detail;
for(i in arr){ console.log(arr[i]. Nossonumero); }`
Not working, appears Undefined on the console;
This JSON is invalid (OR OBJECT)
– Leonardo Bonetti
I wouldn’t have to change the
arr[i]
fordetalhe[i]
?– Sam
var arr receives Detahe before the var arr = req.query.Detail;
– Elisangela Carla DE Souza
You want to loop inside each JSON block as if each block was an Array?
– Sam