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

176
Views
Unnest Javascript Array into JSON

I have created a Javascript array that I need to reformat into Json so that I can display it in a table.

I am trying to take the following javascript array:

[
  {
    "name": "ticker",
    "value": "V"
  },
  {
    "name": 5,
    "value": -0.09453565931246788
  },
  {
    "name": 10,
    "value": -0.08185562540645996
  },
  {
    "name": 90,
    "value": -0.1023591207807445
  },
  {
    "name": 120,
    "value": -0.03745328055393815
  },
  {
    "name": 250,
    "value": 0.13101799630844946
  }
]

And transform it into:

const myTableData = [
  {"name": "ticker", "value": V},
  {"name": "5", "value": -0.09453565931246788},
  {"name": "10", "value": -0.08185562540645996},
  {"name": "90", "value": -0.1023591207807445},
  {"name": "120", "value": -0.03745328055393815},
  {"name": "250", "value": 0.13101799630844946}
];

How can I do this?

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

0

Just use JSON.stringify

var myArray = [
  {
    "name": "ticker",
    "value": "V"
  },
  {
    "name": 5,
    "value": -0.09453565931246788
  },
  {
    "name": 10,
    "value": -0.08185562540645996
  },
  {
    "name": 90,
    "value": -0.1023591207807445
  },
  {
    "name": 120,
    "value": -0.03745328055393815
  },
  {
    "name": 250,
    "value": 0.13101799630844946
  }
];

var myJsonString = JSON.stringify(myArray);
console.log(myJsonString);

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!