JSON.NET deserialize/serialize JsonProperty JsonObject

前端 未结 2 1457
名媛妹妹
名媛妹妹 2021-01-13 01:35

I have a question for deserialize/serialize with the Newtonsoft JSON.NET library:

I receive this json :

 {
    \"customerName\" : \"Lorem\",
    \"id         


        
2条回答
  •  醉酒成梦
    2021-01-13 02:04

    You need to make custom type for "attribute" like:

        public class Attribute {
    
            [JsonProperty(PropertyName = "nbrOfUse")]
            public int _nbrOfUse { get; set; }
            [JsonProperty(PropertyName = "streetType")]
            [Display(Name = "lastUse", ResourceType = typeof(AccountModels))]
            public string _lastUse { get; set; }
    
        }
    

    And make an Object of Attribute class in your Address class.

提交回复
热议问题