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

201
Visualizações
odd behaviour of JSON.parse and JSON.stringify

Ok, so I have an API written in ExprerssJS where I am fetching a value from the Database using Sequelize raw query. Somehow the return JSON result contains backshlashes around the JSON key value e.g. {\"application_id\":1510}.

When I use JSON.parse(JSON.stringify('{\"application_id\":1510}')) inside my expressJs service, it doesn't do anything with supplied JSON object and spits out the input as output.. i.e. no changes though when I use execute this same statement from node command line, I get the desired results where those "" are removed.. see below... This is all on my Mac using same node version. I even tried to run this same command within the Chrome browser's console and can get those "" removed. It just doesn't work within the ExpressJS code.

MC02YC4FLJG5J:~ Dev$ node Welcome to Node.js v16.14.2. Type ".help" for more information.

JSON.parse(JSON.stringify('{\"application_id\":1510}')) '{"application_id":1510}'

Any idea why it behaves differently?

about 4 years ago · Juan Pablo Isaza
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