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

167
Views
Logging object but not able to log the object keys

I have saved an object in Redis in this format

 let redisObject = {
  sessionID: this.data.sessionID,
  forWardTime: new Date(),
 };

I am calling the object and the data is being retrieved successfully

  let redisData = await this.getDataFromRedis ....

And the weird part I am being able to log the Redis data example

console.log("redisData =>",redisData)

it is returing

redisData => {"sessionID":"OyMUuUgeimTeU3OfNWyDtgkGeHsniF","forWardTime":"2022-03-22T19:16:05.507Z"}

But

console.log(redisData.sessionID) 

And

console.log(redisData.forWardTime)

are both returning undefined? What's the problem and what am I missing

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your getDataFromRedis() function isn't parsing the data, so you're logging the JSON string, not an object.

Change to:

let redisData = JSON.parse(await this.getDataFromRedis(...));
about 4 years ago · Juan Pablo Isaza Report
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!