Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

161
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda