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

219
Views
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 answers
Answer question

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 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!