0
var v = [{"filename":"1.mp4","resname":"1280x720","videolength":"00:00:26.07"},{"filename":"2.mp4","resname":"854x480","videolength":"00:00:26.07"},{"filename":"3.mp4","resname":"640x360","videolength":"00:00:26.07"}];

I am using $.parseJSON(v); but have error , any suggestion to get the value of resname ?

Tushar
  • 82,599
  • 19
  • 151
  • 169
FeelRightz
  • 2,479
  • 2
  • 30
  • 60

2 Answers2

2

There is no need to parse v you can access it in different ways

one is by iteration or forloop

v.forEach(function (item, i) {
    alert(item.resname)
});

and you can also directly access the elements by using

 alert(v[0].filename);
alert(v[1].filename);
abhi
  • 1,027
  • 9
  • 19
2

Try:

var v = [{"filename":"1.mp4","resname":"1280x720","videolength":"00:00:26.07"},{"filename":"2.mp4","resname":"854x480","videolength":"00:00:26.07"},{"filename":"3.mp4","resname":"640x360","videolength":"00:00:26.07"}];

$.each(v,function (i, val) {
    console.log(val.resname)
});
madalinivascu
  • 31,556
  • 4
  • 35
  • 52