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

163
Views
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 answers
Answer question

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 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!