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

92
Vistas
how to add new key value pair from frontend in API response

how would i add a new key value pair from frontend in API response

e.g

I have the following response :

[
  {
    "userId": 1,
    "id": 3,
    "title": "fugiat veniam minus",
  },
  {
    "userId": 1,
    "id": 4,
    "title": "et porro tempora",
  },
]

and I want to add this key value pair ("completed": false) to make it look like the following response:

[ 
  {
    "userId": 1,
    "id": 3,
    "title": "fugiat veniam minus",
    "completed": false
  },
  {
    "userId": 1,
    "id": 4,
    "title": "et porro tempora",
    "completed": true
  },
]
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can do this with map. and set true, false with the desired condition.

const newArr = [
  {
    "userId": 1,
    "id": 3,
    "title": "fugiat veniam minus",
  },
  {
    "userId": 1,
    "id": 4,
    "title": "et porro tempora",
  }
].map(v => ({...v, completed: true or false}))
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