Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

139
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda