ASP.Net MVC 3 - JSON Model binding to array

前端 未结 3 1765
谎友^
谎友^ 2020-12-28 17:32

I am on ASP.Net MVC 3, and going by the feature list supported in at, i should be able to get default json model binding working out of the box. However i havent been succes

3条回答
  •  囚心锁ツ
    2020-12-28 18:13

    As Cresnet Fresh rightly pointed out in the comments to the question the model properties must be marked public.

    So modifying Discount class as below resolved this.

    public class Discount
    {
        public string Sku{get; set;}
        public string DiscountValue{get; set;}
        public string DiscountType{get; set;}
    
    }
    

提交回复
热议问题