jquery - Looping over strings in JSON -


my json looks this:

{"roomnolist":[{"roomno":"ml100"},{"roomno":"ml100"},{"roomno":"ml100"},{"roomno":"ml100"}]} 

i want loop on strings , roomno values.

this should job in modern browsers:

var numbers = obj.roomnolist.map(function(item) {     return item.roomno; }; 

with jquery:

var numbers = $.map(obj.roomnolist, function(item) {     return item.roomno; }); 

see also: jquery.map() array.map()


Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -