我想解析以下JSON
Object { CategoryId: 6, CategoryName: "Blood Blank", CategoryImage: null, CategoryDesc: null }
Object { CategoryId: 10, CategoryName: "Computer Accessories", CategoryImage: null, CategoryDesc: null }
Object { CategoryId: 3, CategoryName: "Groceries", CategoryImage: null, CategoryDesc: null }
Object { CategoryId: 2, CategoryName: "Hospitals", CategoryImage: null, CategoryDesc: null }
Object { CategoryId: 1, CategoryName: "Hotels", CategoryImage: null, CategoryDesc: null }
Object { CategoryId: 5, CategoryName: "Labs", CategoryImage: null, CategoryDesc: null }
Object { CategoryId: 4, CategoryName: "Medicals", CategoryImage: null, CategoryDesc: null }
Object { CategoryId: 8, CategoryName: "Staffing Services", CategoryImage: null, CategoryDesc: null }
Object { CategoryId: 7, CategoryName: "Sweet and Bakeries", CategoryImage: null, CategoryDesc: null }
Object { CategoryId: 9, CategoryName: "Tours and Travels", CategoryImage: null, CategoryDesc: null }
我编写了以下代码来解析JSON,但它无法正常工作
$.ajax({
url: "/api/Main/GetCategories",
type: "Get",
contentType: "application/json",
success: function (payload) {
var htmlstring = "<table border=1>";
htmlstring += "<tr><th>Category Id<th>Category Name<th> Category Image<th> Category Desc";
// htmlstring += "<th>Likes<th>DisLikes</tr>";
$.each(payload, function () {
htmlstring += "<tr>";
$.each(this, function (k, v) {
htmlstring += "<td>" + JSON.parse(JSON.stringify(v));
console.log(JSON.parse(JSON.stringify(v)));
});
});
htmlstring += "</table>";
$("#categorymaster").html(htmlstring);
},
error: function (xmlhttp, errstat, errobj) {
console.log(errobj);
}
});
请帮忙