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

415
Views
How can I convert a LOG .txt to .json using JavaScript?

I'd like to know how can i convert a log to .Json using JS. Reading the data in the LOG and converting it to .json, i searched a lot and didnt find anything about it.

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

0

You can simply read from the .txt file then write the contents to a .json file using JSON.stringify to make sure characters such as newlines and double quotes are escaped properly.

For example using Node.js:

const fs = require('fs');
const contents = fs.readFileSync('log.txt', 'utf8');
fs.writeFileSync('log.json', `{ "data": ${JSON.stringify(contents)} }\n`);
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!