Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

113
Vistas
Object from JSON.parse can not change property value

i am getting frustrated because i have a method which receives a Json in the body.

var user = JSON.parse(req.body.user);
console.log("user: " + user);  //1
console.log("user image: " + user.image); //2

When i check the terminal u got these:

1:

user: {"email":"abc@outlook.com","firstname":"ABC","lastname":"DEF","lastname2":"GHI","phone":"999999999","doctype":"1","numdoc":"999999999","password":"12345678","image":"-","sessionToken":"-","roles":[]}

but in second line I got:

2:

user image: undefined

In another point, I tried to change the image property, and I got these:}

nombre = 'abc';
user.image = nombre;  
console.log("filename:" + nombre);
console.log("new name: " + user.image );

In terminal I got:

filename:abc
new name: undefined

So my question is... an object from JSON.parse function can't be changed?

What am I doing wrong.

Regards

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda