I have the following, I get a Json and I put it back with a For, the intention is to modify some properties in this case the status,
for (var i = 0; i < datos.length; i++) {
if(datos[i].id_expediente === this.id_expediente ){
console.log("actualizo estatus");
var valor_cambio;
datos.splice(i, 1, {id_expediente: datos[i].id_expediente,
demandado: datos[i].demandado,
direccion: datos[i].direccion,
status: "Inicio",
fecha_asignada: datos[i].fecha_asig,
tipo_juicio: datos[i].tipo_juicio
});
}
}
after this cycle it generates the following
console.log("data++->" + JSON.stringify(datos));
[
[
{
"id_expediente": "1111",
"demandado": "Alejandra_prueba",
"direccion": "Plan de Ayala-cdscdscds",
"status": "Inicio",
"fecha_asignada": "2018-06-22 10:38:30",
"tipo_juicio": "zzzzzzxxxxx"
}
],
{
"id_expediente": "123",
"demandado": "José_prueba",
"direccion": "Plan de Ayala_pp",
"status": "Asignada",
"tipo_juicio": "xxxxxxx"
},
{
"id_expediente": "1",
"demandado": "JOSE_prueba",
"direccion": "Barlovento 1",
"status": "Asignada",
"tipo_juicio": "xxxx"
}
]
In this example, if I change the status property, for the 1111 file, the problem is that it adds brackets ([])
The intention is to generate the json without those brackets, and to look like this
[
[//quiero eliminar este corchete
{
"id_expediente": "1111",
"demandado": "Alejandra_prueba",
"direccion": "Plan de Ayala-cdscdscds",
"status": "Inicio",
"fecha_asignada": "2018-06-22 10:38:30",
"tipo_juicio": "zzzzzzxxxxx"
}
],//Eliminar este otro
{
"id_expediente": "123",
"demandado": "José_prueba",
"direccion": "Plan de Ayala_pp",
"status": "Asignada",
"tipo_juicio": "xxxxxxx"
},
{
"id_expediente": "1",
"demandado": "JOSE_prueba",
"direccion": "Barlovento 1",
"status": "Asignada",
"tipo_juicio": "xxxx"
}
]