Q: Get value from unknown json I need only the values .how to get value from these json

-wafer,
-Compound Chocolate,
-Praline Chcolate
etc.....

In this a main problem is "subcategory" and its value is taken from database its change according to database
[{"subcategory":"Wafer"},{"subcategory":"Compound Chocolate"},{"subcategory":"Praline Chcolate"},{"subcategory":"Cookies"},{"subcategory":"Toffee"},{"subcategory":"Eclair"},{"subcategory":"Fruit Chews"}] 

each json has a value like subcategory

A: Fiddle: http://jsfiddle.net/KGms7/
var str = '[{"subcategory":"Wafer"},{"subcategory":"Compound Chocolate"},{"subcategory":"Praline Chcolate"},{"subcategory":"Cookies"},{"subcategory":"Toffee"},{"subcategory":"Eclair"},{"subcategory":"Fruit Chews"}]';
var jsn = JSON.parse(str);

var arr = [];
for(var i in jsn) {
    arr.push(jsn[i].subcategory);
}
alert(arr);

