Jquery convert string of one type to string array.....
- by chandru_cp
Consider a string which is
{"Table" : [{"Bird" : "Peacock"},
{"Bird" : "Crow"}]}
to this ["Peacock", "Crow"] in jquery... Is this possible?
EDIT:
I am doing this but didnt work...
$(document).ready(function() {
var obj = JSON.parse('{"Table" : [{"Bird" : "Peacock"},{"Bird" : "Crow"}]}');
myarray = [];
$.each(obj.table, function(i, v) {
myarray.push(v.Bird);
});
$("#tags").autocomplete(myarray, {
width: 138,
max: 4,
highlight: false,
multiple: true,
multipleSeparator: " ",
scroll: true,
scrollHeight: 300
});
});