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

160
Vistas
How to get the value of the key present inside an object in Javascript

Below is my sample data from which I want to extract the string present inside ResponseVariations array's object : CriterionExpression

Articles":[
"ResponseVariations":[
"CriterionExpression":"User: internal AND Country: CA"
]
]

Code Snippet:
function getChannel(agent){
const channelInfo = agent.Articles;
channelInfo.forEach((ResponseVariations) => {
          if(channelInfo.values(CriterionExpression)!=="DEFAULT_SELECTION")
          var iterator = channelInfo.values();
         console.log(iterator.next().value);
});

But the above criteria is not fitting well to extract information of those criteria in which the String is not DEFAULT_SELECTION. Any suggestions how to traverse this array object's value ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The below code worked in order to fetch the key:

const _dir1 = path.resolve(__dirname, `../`);
    const _config1 = JSON.parse(fs.readFileSync(path.resolve(_dir, "./export.4862052732962492282_2.json"), "utf-8"));
    const filteredArr = {};

    _config1.Articles.forEach(el => {
    if (el.ResponseVariations && el.ResponseVariations.length > 1 ) {
    el.ResponseVariations && el.ResponseVariations.forEach((rv) => {
      if(rv.CriterionExpression !== 'DEFAULT_SELECTION') {
      console.log('not default', rv);
      filteredArr[rv.CriterionExpression]= rv.Text;
      project['data']['supportedChannels'].push(filteredArr);
      }
    })
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