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

140
Views
Remove entire object from a json array javascript

I have a json array like the picture below enter image description here

The position for marker 1 is Null, how can i remove the entire marker 1 object from the array so i only have marker 2,3 and 4 left in the array ? thank you

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

0

jsonArray = jsonArray.filter(item => !item.position.includes(null))

Or

jsonArray = jsonArray.filter(item => item.position[0] !== null && item.position[1] !== null)
about 4 years ago · Juan Pablo Isaza Report

0

You could do something like:

const result = arrayOfObjects.filter((object) => {
  return object.position[0] !== null && object.position[1] !== null);
}
about 4 years ago · Juan Pablo Isaza Report

0

We can use a library lodash and using filter method, like this:

var items = _.filter(items, function(item){return item.position});

or

var items = _.filter(items, function(item){return item.position !== null && item.position !== ""});

we can filter out objects which do have position null

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!