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

191
Views
Can only access some javascript object keys

I am noticing strange behavior from a javascript object in my Node application. The user object is created by parsing a csv file with two columns: Email and ID. For some reason, I can only access one of the fields using the typical methods. The other field always returns undefined. I am using Node 15.12.0.

When I log the user object, it returns: { 'Email': 'email@example.com', ID: '12345' }

Curiously, the ID field does not have quotes when it is logged, but the Email field does have quotes.

I can access user.ID as usual, but user.Email returns undefined.

console.log(Object.keys(user)); // [ 'Email', 'ID' ]

console.log(user.ID); // 12345
console.log(user.Email); // undefined

console.log(user['Email']) // undefined
console.log(user["Email"]) // undefined
console.log(user.email) // undefined
console.log(user["\'Email\'"]) // undefined
console.log(user["'Email'"]) // undefined

console.log(user[Object.keys(user)[0]]) // email@example.com
console.log(Object.values(user)[0]) // email@example.com

I have tried the using JSON.parse(JSON.stringify(user)), but I get the same results as before.

The only way I can access the Email field is by using the user[Object.keys(user)[0]] or Object.values(user)[0] which is very strange to me.

I would appreciate any ideas you have to figure out whats happening here. Is there something I can do to examine the object more closely? Does the quotes around the keys indicate anything?

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!