0

I have data from a result of a query

Data 
[0]  Cells 
    [0]: {key: "name" value:"abc"}
    [1]: {key: "sex" value:"f"}
    // this cell has a long list of array

How to get the value if the key is "name" ?

I attemped

result=res.PrimaryQueryResult.RelevantResults.Table.Rows;

     debugger; 
     var a=result[10].Cells[8]; // This doesn't work

1 Answer 1

0

I managed to get the value i need by

result[i].Cells[14].Value

The concept is like this

//fetch json data alove
 result=res.PrimaryQueryResult.RelevantResults.Table.Rows;

            for(let i=0;i<result.length;i++){
            this.ppl.push({
                   jobtitle:result[i].Cells[14].Value
                    // and more 
                    });
            }
//code continues. 

Would there be a better way to get the value ? e.g. I want to go over the array and search if the Value of "Key" is name, Get the Value of "Value"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.