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
  • 85,780
  • 21
  • 159
  • 179
FeelRightz
  • 2,777
  • 2
  • 38
  • 73

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,059
  • 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
  • 32,064
  • 4
  • 39
  • 55