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

83
Views
Array of dictionaries convert to array of values only

I know it might be a simple task but i couldn't find proper solution for my task.

In JavaScript i have a data that's stored in array of dictionaries.

Example:

[{"car": "volvo", "model":"s40"},{"car": "audi", "model": "a4"}]

how i can convert this to get only values out and store them in to the array of arrays?

result:

[["volvo","s40"],["audi","a4"]]
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

you are looking for the values of each Object so a map and Object.values

let x = [{"car": "volvo", "model":"s40"},{"car": "audi", "model": "a4"}]
let y = x.map(e => Object.values(e))
console.log(y)

about 4 years ago · Juan Pablo Isaza Report

0

You could map the values from the objects directly with Array#map and Object.values.

const
    data = [{ car: "volvo", model: "s40" }, { car: "audi", model: "a4" }],
    values = data.map(Object.values);

console.log(values);
.as-console-wrapper { max-height: 100% !important; top: 0; }

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!