How to collect JSON data in JQuery

0

I have this view of the data in a JSON in JQuery

and I want to do something similar to what is done with laravel data to get the data and contrast it with others, I've done something like this ...

console.log(resenia[0]{cmt_libro_id});

        for (j = 0; j <length($resenia); j++) {

            if (resenia[j]{cmt_libro_id}==id)
            {
                cmt_no[j] = resenia[j]{cmt_no};
                cmt_titulo[j] =resenia[j]{cmt_no};

            }
        }
    
asked by Maria Rosa Cambero 17.02.2018 в 14:53
source

1 answer

1

The syntax in Javascript to get an attribute is like the following example:

let obj= [
  { attr1 : 1},
  { attr1 : 2},
  { attr1 : 3},
  { attr1 : 4}
];

console.log(obj[0].attr1); //opcion 1
console.log(obj[2]['attr1']); //opcion 2
    
answered by 17.02.2018 / 15:32
source