Deserializing JSON result with Json & JavaScriptSerializer

后端 未结 2 690
遥遥无期
遥遥无期 2021-01-16 02:45

here\'s my problem:

I\'m trying to deserialize json that hasn\'t been done by me. The format of the json is as follows:

{\"responseId\":1200,
\"avail         


        
2条回答
  •  离开以前
    2021-01-16 03:05

    It's difficult to interpret the structure of your objects based on your description but I was able to deserialize your sample JSON using the following minimal code:

    var result = JsonConvert.DeserializeObject(json);
    
    public class getAvailableHotelResponse
    {
        public int responseId;
        public availableHotel[] availableHotels;
        public int totalFound;
        public string searchId;
    }
    
    public class availableHotel
    {
        public string processId;
        public string hotelCode;
        public string availabilityStatus;
    }
    

提交回复
热议问题