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

216
Visualizações
Remove escaped character in nodejs

I have extracted data into JSON dump / JSON format. Its a huge data of more than 90,000 lines in it. When I extracted, some characters are escaped and replaced. for example " is replaced by \".

I want to remove \r completely and replace \" to "

I dont want to use .replace method of javascript. Can anyone help me to replace the escaped characters \" and \r to their original form. I have tried JSON.parse and .replace methods but it seems to be not working.

Please if anyone have idea to replace them in nodejs, it would be really helpful. Thanks

one line from the json file:

{"time": "10:00", "date": "30-04-2022", "value": "{\"number\":\"1\", \"data\": {\"score\": \"5\", \"team\": "\abc"\}}\r}

expected outcome: {"time": "10:00", "date": "30-04-2022", "value": "{"number":"1", "data": {"score": "5", "team": "abc"}}\r}

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

JavaScript replace function only removes the first intersecting substring from the Value

You can use the following code to replace each substring:

function replaceAll(Value, subString, Target) {
    let result = Value;
    while(result.includes(subString)) {
        result.replace(subString, Target);
    }

    return result;
}

I really don't know if you are replacing that text in runtime but you can actually use ctrl + h and replace every substring,

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