RestSharp Deserialization with JSON Array

后端 未结 5 1143
北海茫月
北海茫月 2021-01-01 15:27

I have a JSON response that I\'m trying to deserialize with RestSharp, and it looks like this:

{\"devices\":[{\"device\":{\"id\":7,\"deviceid\":\"abc123\",\"         


        
5条回答
  •  说谎
    说谎 (楼主)
    2021-01-01 15:54

    My problem was entirely different, I naively thought JsonDeserializer supports JsonProperty attribute, but thats not true. So when trying to deserialize into

    public class AvailableUserDatasApi
    {
        [JsonProperty("available-user-data")]
        public List AvailableUserDatas { get; set; }
    }
    

    it failed.. But changing AvailableUserDatas to AvailableUserData was enough for things to start working.

提交回复
热议问题