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

161
Views
Remove First and Last Double Quote From JSON Array

Here i have one big array that has multiple arrays inside. I need to remove double quotes from each array. I tried all different methods to pull out quotes but none seem to work.

Current code produces this result:

[
  ["1,jone,matt,ny,none,doctor"],
  ["2,maria,lura,nj,some,engineer"],
  ["3,paul,kirk,la,none,artist"]
]

I need it this way:

[
  [1,jone,matt,ny,none,doctor],
  [2,maria,lura,nj,some,engineer],
  [3,paul,kirk,la,none,artist]
]
    const storeArray = [];

    for(var i = 0; i < results.length; i++) {

      var finalArray = results[i].id + "," + results[i].name + "," + results[i].lastname + "," + results[i].address + "," + results[i].status + "," + results[i].about;

      storeArray.push([finalArray]);
    }

    res.send(storeArray);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You're creating strings as the first element of an array instead of an array of elements. You'll still have to contend with quotes because some of your data are strings - there's no getting round that - but this is closer to what you want.

const results = [
  { id: 1, name: 'Andy', lastname: 'Jones', address: '999 Letsbe Avenue', status: 5, about: 'About' },
  { id: 2, name: 'Sue', lastname: 'Barlow', address: '1 Fifth Street', status: 1, about: 'Another about' }
];

const storeArray = [];

for (let i = 0; i < results.length; i++) {

  storeArray.push([
    results[i].id,
    results[i].name,
    results[i].lastname,
    results[i].address,
    results[i].status,
    results[i].about
  ]);

}

console.log(storeArray);

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!