Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!