Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

168
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda