에서 JSON 개체를 만듭니다. 나는 그렇게 JSON() 메소드를 사용하십시오 categoriesVM 객체가 제대로 건설되고있다내가 그렇게 보이는 뷰 모델이 C# 클래스
List<CategoriesJsonViewModel> categoriesVM = new List<CategoriesJsonViewModel>();
List<Category> categories = repo.GetAllCategories();
foreach(var i in categories)
{
CategoriesJsonViewModel categoryVM = new CategoriesJsonViewModel();
categoryVM.Id = i.Id;
categoryVM.Title = i.Title;
categoriesVM.Add(categoryVM);
categoryVM.UsedDescriptions = repo.GetUsedDescriptions(i.Id);
categoryVM.UnusedDescriptions = repo.GetUnusedDescriptions(i.Id);
}
return Json(categoriesVM);
있지만, 나는 어떤 이유로 그것에서 적절한 JSON 개체를하지 않습니다. 왜 그래야만하지?
"나는 적절한 Json 객체를 얻지 못했습니다."- 구체적으로 ** 무엇이 다른가/부적절한가요? –
예상되는 JSON 출력 대 실제 JSON 출력을 표시해야 할 수 있습니다. –
어떤 오류가 발생합니까? – HaBo