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

189
Views
JSON.stringify returns " instead of ""

I'm looking to turn text like this into JSON:

Company     Team
Facebook    Marketing
Google      Engineering
Microsoft   Product

When I log the JSON.stringify returns " instead of ". Why does that happen? What can I change to prevent this?

let pre = document.querySelector('pre').innerHTML;

var cells = pre.split('\n').map(function (el) { return el.split(/\s+/); });

var headings = cells.shift();

var obj = cells.map(function (el) {
  var obj = {};
  for (var i = 0, l = el.length; i < l; i++) {
    obj[headings[i]] = isNaN(Number(el[i])) ? el[i] : +el[i];
  }
  return obj;
});


var json = JSON.stringify(obj,null,5);
console.log(json)

JS Fiddle

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