Currently, I am working with JSON stringify and here is the code snippet:
var myObject = {};
for(var i=0; i < arr.length; i++){
myObject[i]=[];
//myObject[i].push('image:'+arr[i].id);
myObject[i].push('nick:'+arr[i].nick);
myObject[i].push('phone number:'+arr[i].tlfno);
myObject[i].push('name:'+arr[i].nombre);
myObject[i].push('description:'+arr[i].descripcion);
myObject[i].push('address:'+arr[i].direccion);
myObject[i].push('date:'+arr[i].fecha);
myObject[i].push('state:'+arr[i].estado);
myObject[i].push('image type:'+arr[i].tipoimagen);
//myObject[i].push('image:'+arr[i].imagen);
}
var jsonData = JSON.stringify(myObject);
console.log(jsonData);
The output that I am receiving is as follows:
{"0":["nick:pepe","phone number:678909897","name:dsfdfsf","description:dsdsdsd","address:fdfdf","date:fdfdf","state:1","image type:image/jpeg"]
However, this is not correct. The desired output should look something like this:
{"0":["nick":"pepe"
including double quotes. Can anyone assist in achieving this? Thank you.