I have this string which I get from code behind:
{Name:"Tshirt", CatGroupName:"Clothes", Gender:"male-female"}, {Name:"Dress", CatGroupName:"Clothes", Gender:"female"}, {Name:"Belt", CatGroupName:"Leather", Gender:"child"}
I need to convert it to an array of objects like this:
var Categories =
[
{Name:"Tshirt", CatGroupName:"Clothes", Gender:"male-female"},
{Name:"Dress", CatGroupName:"Clothes", Gender:"female"},
{Name:"Belt", CatGroupName:"Leather", Gender:"child"}
];
Because I need to perform some functions on it. (like $.grep and so on)
How can I convert it? Thanx in advance.
JSON.parse. Also this is not an associative array, it's an array of objects.JSON.parseinstead.