C#实体类属性大写转JSON变成小写

C#服务实体类序列化后属性名称开头如果有大写使用JAVA 反序列化工具时无法对应实体类小写字母,需要把序列化里面属性开头字母转换为小写字母;
使用Newtonsoft中的[JosonProperty]标签

 public class StockStorageInfo
    {
        /// 
        /// 产品名称
        /// 
        [DataMember]
        [JsonProperty("productname")]
        public string ProductName { get; set; }
        /// 
        /// 产品描述
        /// 
        [DataMember]
        [JsonProperty("productdescription")]
        public string ProductDescription { get; set; }
        /// 
        /// 库存状态
        /// 
        [DataMember]
        [JsonProperty("subjectname")]
        public string SubjectName { get; set; }
        /// 
        /// 货位描述
        /// 
        [DataMember]
        [JsonProperty("galdescription")]
        public string GalDescription { get; set; }
        /// 
        /// 重量
        /// 
        [DataMember]
        [JsonProperty("an")]
        public decimal? AN { get; set; }
        /// 
        /// 件数
        /// 
        [DataMember]
        [JsonProperty("pn")]
        public int? PN { get; set; }
        /// 
        /// 件数
        /// 
        [DataMember]
        [JsonProperty("rarname")]
        public string RarName { get; set; }


    }

{"d":"{"Result":[{"productname":"产品1","productdescription":"塑化产品2/规格2/产品等级2/塑化产地2/包装222","subjectname":"可用库存","galdescription":"test11","an":172.0000,"pn":46,"rarname":"test11"},{"productname":"产品1","productdescription":"塑化产品2/规格2/产品等级2/塑化产地2/包装222","subjectname":"可用库存","galdescription":"test11","an":182.0000,"pn":56,"rarname":"test11"},{"productname":"产品1","productdescription":"塑化产品2/规格2/产品等级2/塑化产地2/包装222","subjectname":"冻结","galdescription":"test11","an":6.0000,"pn":5,"rarname":"test11"},{"productname":"产品1","productdescription":"塑化产品2/规格2/产品等级2/塑化产地2/包装222","subjectname":"冻结","galdescription":"test11","an":6.0000,"pn":5,"rarname":"test11"},{"productname":"产品1","productdescription":"塑化产品2/规格2/产品等级2/塑化产地2/包装222","subjectname":"可用库存","galdescription":"test6","an":3.0000,"pn":3,"rarname":"test11"},{"productname":"产品1","productdescription":"塑化产品2/规格2/产品等级2/塑化产地2/包装222","subjectname":"可用库存","galdescription":"test11","an":14.0000,"pn":14,"rarname":"test11"},{"productname":"产品1","productdescription":"塑化产品2/规格2/产品等级2/塑化产地2/包装222","subjectname":"可用库存","galdescription":"test2","an":1.0000,"pn":1,"rarname":"test11"},{"productname":"产品1","productdescription":"塑化产品2/规格2/产品等级2/塑化产地2/包装222","subjectname":"可用库存","galdescription":"test2","an":1.0000,"pn":1,"rarname":"test11"},{"productname":"产品1","productdescription":"塑化产品2/规格2/产品等级2/塑化产地2/包装222","subjectname":"可用库存","galdescription":"test2","an":1.0000,"pn":1,"rarname":"test11"},{"productname":"产品1","productdescription":"塑化产品2/规格2/产品等级2/塑化产地2/包装222","subjectname":"可用库存","galdescription":"test2","an":1.0000,"pn":1,"rarname":"test11"}],"ErrorStatus":6,"FeedbackMessage":"1,5,41"}"}

你可能感兴趣的:(C#实体类属性大写转JSON变成小写)