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

167
Views
Extract only key names from JSON in array format using nodejs

How to get JSON data key names in a array format using nodejs?

I've tried the following but it returns object. But I want an array so I can store it in a varaible.

const jsondata = [{ "name": "StorageType", "value": "AllStorageTypes" }, { "name": "BucketName", "value": "testing" }]

Object.keys(jsondata).forEach(function(key) {
  var value = jsondata[key];
  console.log(value)
});

output:

{ name: 'StorageType', value: 'AllStorageTypes' }
{ name: 'BucketName', value: 'testing' }

Expected output:

["StorageType", "BucketName"]
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Try this

const jsondata = [{ "name": "StorageType", "value": "AllStorageTypes" }, { "name": "BucketName", "value": "testing" }]

const arrayData = jsondata.map(item => item.name)
console.log(arrayData)

about 4 years ago · Juan Pablo Isaza Report

0

jsondata.map(obj=>obj.name)

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!