我无法反序列化 JSON 对象,它 returns null

I cannot deserialize JSON object, it returns null

我正在收集一个 API 并且我无法反序列化一个 JSON 属性 我不知道问题出在哪里。

所以我有一个来自 convertJSON2CSharp 的对象:

public class HotelViewModel {
  public class HotelDistance {
    public double distance {
      get;
      set;
    }
    public string distanceUnit {
      get;
      set;
    }
  }

  public class Address {
    public List < string > lines {
      get;
      set;
    }
    public string postalCode {
      get;
      set;
    }
    public string cityName {
      get;
      set;
    }
    public string countryCode {
      get;
      set;
    }
  }

  public class Contact {
    public string phone {
      get;
      set;
    }
    public string fax {
      get;
      set;
    }
    public string email {
      get;
      set;
    }
  }

  public class Description {
    public string lang {
      get;
      set;
    }
    public string text {
      get;
      set;
    }
  }

  public class Medium {
    public string uri {
      get;
      set;
    }
    public string category {
      get;
      set;
    }
  }

  public class Hotel {
    public string type {
      get;
      set;
    }
    public string hotelId {
      get;
      set;
    }
    public string chainCode {
      get;
      set;
    }
    public string dupeId {
      get;
      set;
    }
    public string name {
      get;
      set;
    }
    public string rating {
      get;
      set;
    }
    public string cityCode {
      get;
      set;
    }
    public double latitude {
      get;
      set;
    }
    public double longitude {
      get;
      set;
    }
    public HotelDistance hotelDistance {
      get;
      set;
    }
    public Address address {
      get;
      set;
    }
    public Contact contact {
      get;
      set;
    }
    public Description description {
      get;
      set;
    }
    public List < string > amenities {
      get;
      set;
    }
    public List < Medium > media {
      get;
      set;
    }
  }

  public class RateFamilyEstimated {
    public string code {
      get;
      set;
    }
    public string type {
      get;
      set;
    }
  }

  public class TypeEstimated {
    public string category {
      get;
      set;
    }
    public int beds {
      get;
      set;
    }
    public string bedType {
      get;
      set;
    }
  }

  public class Room {
    public string type {
      get;
      set;
    }
    public TypeEstimated typeEstimated {
      get;
      set;
    }
    public Description description {
      get;
      set;
    }
  }

  public class Guests {
    public int adults {
      get;
      set;
    }
  }

  public class Average {
    public string @base {
      get;
      set;
    }
  }

  public class Change {
    public string startDate {
      get;
      set;
    }
    public string endDate {
      get;
      set;
    }
    public string @base {
      get;
      set;
    }
    public string total {
      get;
      set;
    }
  }

  public class Variations {
    public Average average {
      get;
      set;
    }
    public List < Change > changes {
      get;
      set;
    }
  }

  public class Price {
    public string currency {
      get;
      set;
    }
    public string @base {
      get;
      set;
    }
    public string total {
      get;
      set;
    }
    public Variations variations {
      get;
      set;
    }
  }

  public class AcceptedPayments {
    public List < string > creditCards {
      get;
      set;
    }
    public List < string > methods {
      get;
      set;
    }
  }

  public class Guarantee {
    public AcceptedPayments acceptedPayments {
      get;
      set;
    }
  }

  public class Cancellation {
    public int numberOfNights {
      get;
      set;
    }
    public DateTime deadline {
      get;
      set;
    }
  }

  public class HoldTime {
    public DateTime deadline {
      get;
      set;
    }
  }

  public class Policies {
    public Guarantee guarantee {
      get;
      set;
    }
    public string paymentType {
      get;
      set;
    }
    public Cancellation cancellation {
      get;
      set;
    }
    public HoldTime holdTime {
      get;
      set;
    }
  }

  public class Commission {
    public string amount {
      get;
      set;
    }
    public string percentage {
      get;
      set;
    }
  }

  public class Offer {
    public string id {
      get;
      set;
    }
    public string checkInDate {
      get;
      set;
    }
    public string checkOutDate {
      get;
      set;
    }
    public string rateCode {
      get;
      set;
    }
    public RateFamilyEstimated rateFamilyEstimated {
      get;
      set;
    }
    public Room room {
      get;
      set;
    }
    public Guests guests {
      get;
      set;
    }
    public Price price {
      get;
      set;
    }
    public Policies policies {
      get;
      set;
    }
    public Commission commission {
      get;
      set;
    }
  }

  public class Datum {
    public string type {
      get;
      set;
    }
    public Hotel hotel {
      get;
      set;
    }
    public bool available {
      get;
      set;
    }
    public List < Offer > offers {
      get;
      set;
    }
    public string self {
      get;
      set;
    }
  }

  public class Links {
    public string next {
      get;
      set;
    }
  }

  public class Meta {
    public Links links {
      get;
      set;
    }
  }

  public class Root {
    public List < Datum > data {
      get;
      set;
    }
    public Meta meta {
      get;
      set;
    }
  }

  public class HotelViewModelJson {
    public Root root;
  }
}

在控制器中我想转换它...简单地 hvm.Root returns null ...

if (response.IsSuccessStatusCode) {
  var readAllAsync = await response.Content.ReadAsStringAsync();
  var readAsObject = JObject.Parse(readAllAsync);
  HotelViewModel.HotelViewModelJson hvm = JsonConvert.DeserializeObject < HotelViewModel.HotelViewModelJson > (readAsObject.ToString());
}

我根本看不出问题,但我的根无法加载所需的属性...我尝试了多种方法但没有任何效果...在此先感谢。

JSON 在这里

{"data":[{"type":"hotel-offers","hotel":{"type":"hotel","hotelId":"INMAD23B","chainCode":"IN","dupeId":"700211421","name":"Hotel Indigo Gran Via","rating":"3","cityCode":"MAD","latitude":40.42073,"longitude":-3.70744,"hotelDistance":{"distance":0.2,"distanceUnit":"KM"},"address":{"lines":["CALLE SILVA 6"],"postalCode":"28013","cityName":"MADRID","countryCode":"ES"},"contact":{"phone":"+34 91 2008585","fax":"+34 91 2008590"},"description":{"lang":"en","text":"Welcome to Hotel Indigo Madrid Gran Via Discover Madrid at the unique Hotel Indigo Madrid Gran Via combining a different boutique experience with a fresh design that stimulates you and dive in the local culture.  The hotels fresh and stylish design is original and deliberately evocative of its culturally rich urban environment. Our individually styled rooms capture the history of the neighbourhood through its design and artwork.  Hotel Indigo Madrid Gran Via is ideally located in the heart of the city close to key tourist attractions such as Puerta del Sol Plaza Mayor and Royal Palace.  A 25 minute taxi ride from Barajas Madrid airport the hotel is also just a few minutes walk from Atocha Train Station with direct links to the entire city and surrounding areas like Aranjuez or Toledo.  Hotel Indigo Madrid Gran Via offers a local touch like plush bedding hard surface flooring with area rugs and spa inspired bathrooms as well as oversized and interpretive photographic murals of Madrid imagery.  Complimentary WiFi throughout the hotel allows you to surf the web over drinks in the Gastro Bar and Restaurant enjoying the urban life of Madrid in our Lounge and  Pool Bar on the rooftop.  Our Fitness Room provides the perfect workout to wind down after a long day of business or tourism in the city."},"amenities":["24_HOUR_FRONT_DESK","24_HOUR_ROOM_SERVICE","AIRLINE_DESK","ATM/CASH_MACHINE","CAR_RENTAL","CONFERENCE_FACILITIES","EXCHANGE_FACILITIES","DOCTOR_ON_CALL","GYM","EXPRESS_CHECK_OUT","ACCESSIBLE_FACILITIES","WHEELCHAIR_ACCESSIBLE_PUBLIC_AREA","HANDRAILS_BATHROOM","ACCESSIBLE_PARKING","WHEELCHAIR_ACCESSIBLE_ROOM","GARAGE_PARKING","JOGGING_TRACK","LAUNDRY_SERVICE","ON-SITE_PARKING","OUTDOOR_POOL","PARKING","SWIMMING_POOL","RESTAURANT","SOLARIUM","DRY_CLEANING","PORTER/BELLBOY","BEAUTY_PARLOUR","FRONT_DESK","WIRELESS_CONNECTIVITY","HIGH_SPEED_WIRELESS","FEMA_FIRE_SAFETY_COMPLIANT","PHOTOCOPIER","PRINTER","BUSINESS_CENTER","COMPUTER_RENTAL","MEETING_FACILITIES","FIRE_SAFETY","EMERGENCY_BACKUP_GENERATOR","EMERGENCY_LIGHTING","FIRE_DETECTORS","SPRINKLERS","FIRST_AID_STAF","VIDEO_SURVEILANCE","EXTINGUISHERS","FEMA_FIRE_SAFETY_COMPLIANT","GOLF","BOATING","FISHING","SNOW_SKIING"],"media":[{"uri":"http://uat.multimediarepository.testing.amadeus.com/cmr/retrieve/hotel/977639BBEA1C4AE0B143077B8FB5068E","category":"EXTERIOR"}]},"available":true,"offers":[{"id":"N4V99S74DF","checkInDate":"2021-04-26","checkOutDate":"2021-04-27","rateCode":"22A","rateFamilyEstimated":{"code":"BAR","type":"P"},"room":{"type":"*RH","typeEstimated":{"category":"STANDARD_ROOM","beds":1,"bedType":"DOUBLE"},"description":{"text":"BEST FLEXIBLE RATE\nSTANDARD ROOM NS CONTEMPORARY STYLED DOUBLE\nROOM. YOUR BED TYPE PREFERENCES WILL BE"}},"guests":{"adults":1},"price":{"currency":"EUR","base":"170.00","total":"170.00","variations":{"average":{"base":"170.00"},"changes":[{"startDate":"2021-04-26","endDate":"2021-04-27","base":"170.00"}]}},"policies":{"guarantee":{"acceptedPayments":{"creditCards":["AX","VI","CA"],"methods":["CREDIT_CARD"]}},"paymentType":"guarantee","cancellation":{"numberOfNights":1,"deadline":"2021-04-24T14:23:00+02:00"}}}],"self":"https://test.api.amadeus.com/v2/shopping/hotel-offers/by-hotel?hotelId=INMAD23B"},{"type":"hotel-offers","hotel":{"type":"hotel","hotelId":"RTMADPUL","chainCode":"RT","dupeId":"700012793","name":"Mercure Madrid Plaza de Espana","rating":"4","cityCode":"MAD","latitude":40.42566,"longitude":-3.7138,"hotelDistance":{"distance":0.9,"distanceUnit":"KM"},"address":{"lines":["TUTOR 1"],"postalCode":"28008","cityName":"MADRID","countryCode":"ES"},"contact":{"phone":"34/91/5419880","fax":"34/91/5425736","email":"H1320@accor.com"},"description":{"lang":"en","text":"The hotel is located 547 yards (500 m) from the Plaza de España. Its 97 rooms offer comfortable beds, minibar, LCD TV, WIFI and free coffee. Why not book a Privilege Room with a large terrace, Nespresso machine and complimentary minibar? Near to the hotel, you will find Plaza de Los Cubos with its plethora of restaurants, cinemas and a fitness center (free for hotel guests). The Gran Vía with its musicals is just five minutes away on foot. The zoo and theme park are ten minutes away by car"},"amenities":["ELEVATOR","SAFE_DEPOSIT_BOX","ROOM_SERVICE","INTERNET_SERVICES","220_AC","PARKING","PETS_ALLOWED","ACCESSIBLE_BATHS","ADAPTED_PHONES","WHEELCHAIR_ACCESSIBLE_PUBLIC_AREA","DISABLED_FACILITIES","WIRELESS_CONNECTIVITY","KIDS_WELCOME","LOUNGE","DOCTOR_ON_CALL","24_HOUR_FRONT_DESK","CONNECTING_ROOMS","SMOKE_DETECTOR","FIRE_SAFETY","EMERGENCY_BACKUP_GENERATOR","FIRE_DETECTORS","EMERGENCY_LIGHTING","GARAGE_PARKING","BABY-SITTING","MULTILINGUAL_STAFF","PHOTOCOPIER","MEETING_FACILITIES","COMPUTER_RENTAL","MEETING_ROOMS","BUSINESS_CENTER","AUDIO-VISUAL_EQUIPMENT","HIGH_SPEED_INTERNET_IN_ROOM","BIDET","BATH","CRIBS_AVAILABLE","ALARM_CLOCK","WAKEUP_SERVICE","WI-FI_IN_ROOM","DIRECT_DIAL_PHONE","HAIR_DRYER","CABLE_TELEVISION","TELEVISION","SATELLITE_TV","AIR_CONDITIONING","FREE_NEWSPAPER","TROUSER_PRESS","SAFE","NON_SMOKING_ROOMS"],"media":[{"uri":"http://uat.multimediarepository.testing.amadeus.com/cmr/retrieve/hotel/472A9DE856E04722950BB376FBB72D5D","category":"EXTERIOR"}]},"available":true,"offers":[{"id":"WONWXHD3UR","checkInDate":"2021-04-26","checkOutDate":"2021-04-27","rateCode":"RDI","rateFamilyEstimated":{"code":"RAC","type":"P"},"commission":{"amount":"0","percentage":"0"},"room":{"type":"B2T","typeEstimated":{"category":"SUPERIOR_ROOM","beds":2,"bedType":"SINGLE"},"description":{"text":"Rack rate-Room only\nSuperior Room with 2 single beds"}},"guests":{"adults":1},"price":{"currency":"EUR","total":"330.00","variations":{"average":{"base":"330.00"},"changes":[{"startDate":"2021-04-26","endDate":"2021-04-27","total":"330.00"}]}},"policies":{"holdTime":{"deadline":"2021-04-26T18:00:00"},"guarantee":{"acceptedPayments":{"creditCards":["AX","BF","CA","DC","EC","IK","JC","VI"],"methods":["CREDIT_CARD"]}},"paymentType":"guarantee","cancellation":{"deadline":"2021-04-25T00:00:00+02:00"}}}],"self":"https://test.api.amadeus.com/v2/shopping/hotel-offers/by-hotel?hotelId=RTMADPUL"},{"type":"hotel-offers","hotel":{"type":"hotel","hotelId":"WIMAD079","chainCode":"WI","dupeId":"700013562","name":"THE WESTIN PALACE MADRID","rating":"5","cityCode":"MAD","latitude":40.41575,"longitude":-3.69573,"hotelDistance":{"distance":1.0,"distanceUnit":"KM"},"address":{"lines":["PLAZA DE LAS CORTES 7"],"postalCode":"28014","cityName":"MADRID","countryCode":"ES"},"contact":{"fax":"34-91-3608100","phone":"34-91-3608000"},"description":{"lang":"en","text":"Located in Madrid's center.. it's known for its spectacular stained glass dome and proximity to the Prado.. Thyssen and Reina Sofia museums."},"amenities":["AUDIO-VISUAL_EQUIPMENT","BUSINESS_CENTER","MEETING_ROOMS","BAR","COFFEE_SHOP","RESTAURANT","DISABLED_FACILITIES","ADAPT_ROOM_DOORS","BEAUTY_PARLOUR","ELEVATOR","EXCHANGE_FACILITIES","GIFT_SHOP","WIFI","LAUNDRY_SERVICE","MASSAGE","SAUNA","SOLARIUM","VALET_PARKING","HAIRDRESSER","AIR_CONDITIONING","HAIR_DRYER","MOVIE_CHANNELS","NON_SMOKING_ROOMS","ROOM_SERVICE","TELEVISION","SAFE_DEPOSIT_BOX","FITNESS_CENTER"],"media":[{"uri":"http://uat.multimediarepository.testing.amadeus.com/cmr/retrieve/hotel/102EBFF9C8C74FDBB2FCE9D34B2C832C","category":"EXTERIOR"}]},"available":true,"offers":[{"id":"1DJW9N0RQY","checkInDate":"2021-04-26","checkOutDate":"2021-04-27","rateCode":"S9R","rateFamilyEstimated":{"code":"SRS","type":"C"},"room":{"type":"XMI","typeEstimated":{"category":"DELUXE_ROOM","beds":1,"bedType":"SINGLE"},"description":{"text":"Marriott Senior Discount, includes 62 years and older valid ID \nDeluxe, 2 Twin/Single Bed(s), 29sqm/312sqft, Wi\nreless internet, for a fee, 48in/122cm LED TV"}},"guests":{"adults":1},"price":{"currency":"EUR","base":"255.00","total":"280.50","variations":{"average":{"base":"255.00"},"changes":[{"startDate":"2021-04-26","endDate":"2021-04-27","base":"255.00"}]}},"policies":{"paymentType":"guarantee","cancellation":{"numberOfNights":1,"deadline":"2021-04-25T23:59:00+02:00"}}}],"self":"https://test.api.amadeus.com/v2/shopping/hotel-offers/by-hotel?hotelId=WIMAD079"},{"type":"hotel-offers","hotel":{"type":"hotel","hotelId":"ARMADREC","chainCode":"AR","dupeId":"700046865","name":"AC BY MARRIOTT HOTEL RECOLETOS","rating":"4","cityCode":"MAD","latitude":40.42156,"longitude":-3.68946,"hotelDistance":{"distance":1.4,"distanceUnit":"KM"},"address":{"lines":["RECOLETOS 18 "],"postalCode":"28001","cityName":"MADRID","countryCode":"ES"},"contact":{"phone":"34-91-4361382","fax":"34-91-4361383"},"description":{"lang":"en","text":"Between “Calle Serrano” and “Paseo de Recoletos”, one step from the Retiro Park and with all the details of an AC Selection intensely lived day and night.\r\rIts neoclassical façade is adorned with impressive wrought iron balconies, a characteristic of Madrid architecture, and its unbeatable location means this luxurious building is close to many things, making comfort another of its dominant tones.\r\rThe hotel has a total of 63 rooms. Each and every one is equipped with a set of one-of-a-kind features that guarantee a stay that is modern and enveloped in comfort:  WiFi internet system, plasma TV with over 20 channels (Canal + Digital), mini-chain with 4 pillows and be and safe. Technology is very present in the hotel’s luminous rooms. Among the various services on offer, we point out the large space incorporated into the suite for holding meetings.\r\rThe hotel’s common areas are equipped with the full range of comforts. Guests will enjoy a full fitness centre, where they can get in shape during their stay. Functionality, comfort and design, the essential features of AC Hotels are present everywhere you look. These includes a well-stocked  library, a place to relax and enjoy some quiet reading,  \r\rThe cosmopolitan spirit of this hotel is also readily apparent in its bar and lounge. Open until midnight to facilitate rendezvous between customers, it offers a simple menu that is light and well prepared , perfect for healthy snacking in designer atmosphere."},"amenities":["MEETING_ROOMS","RESTAURANT","DISABLED_FACILITIES","DISABLED_ACCESSIBLE_TOILETS","SERVICE_DOGS_ALLOWED","HANDRAILS_BATHROOM","ELEVATOR","WIFI","LAUNDRY_SERVICE","AIR_CONDITIONING","HAIR_DRYER","MINIBAR","NON_SMOKING_ROOMS","ROOM_SERVICE","TELEVISION","SAFE_DEPOSIT_BOX","FITNESS_CENTER"],"media":[{"uri":"http://uat.multimediarepository.testing.amadeus.com/cmr/retrieve/hotel/1722412666BC4A31B7040FBAE566202D","category":"EXTERIOR"}]},"available":true,"offers":[{"id":"B2MSSNHDVF","checkInDate":"2021-04-26","checkOutDate":"2021-04-27","rateCode":"RAC","room":{"type":"EUP","typeEstimated":{"beds":1,"bedType":"QUEEN"},"description":{"text":"Welcome Back, includes breakfast, see Rate Rules\n1 Queen, Mini fridge, 19sqm/204sqft-22sqm/237sq\nft, Wireless internet, complimentary, Coffee/te"}},"guests":{"adults":1},"price":{"currency":"EUR","base":"140.00","total":"154.00","variations":{"average":{"base":"140.00"},"changes":[{"startDate":"2021-04-26","endDate":"2021-04-27","base":"140.00"}]}},"policies":{"paymentType":"guarantee","cancellation":{"deadline":"2021-04-25T23:59:00+02:00"}}}],"self":"https://test.api.amadeus.com/v2/shopping/hotel-offers/by-hotel?hotelId=ARMADREC"},{"type":"hotel-offers","hotel":{"type":"hotel","hotelId":"ARMADATO","chainCode":"AR","dupeId":"700142091","name":"AC BY MARRIOTT HOTEL ATOCHA","rating":"4","cityCode":"MAD","latitude":40.40393,"longitude":-3.68976,"hotelDistance":{"distance":2.3,"distanceUnit":"KM"},"address":{"lines":["CALLE DELICIAS 42 "],"postalCode":"28045","cityName":"MADRID","countryCode":"ES"},"contact":{"phone":"34-91-5062221","fax":"34-91-5062222"},"amenities":["MEETING_ROOMS","RESTAURANT","DISABLED_FACILITIES","DISABLED_ACCESSIBLE_TOILETS","SERVICE_DOGS_ALLOWED","HANDRAILS_BATHROOM","ELEVATOR","WIFI","LAUNDRY_SERVICE","AIR_CONDITIONING","HAIR_DRYER","MINIBAR","NON_SMOKING_ROOMS","DIRECT_DIAL_PHONE","ROOM_SERVICE","TELEVISION","SAFE_DEPOSIT_BOX","FITNESS_CENTER"],"media":[{"uri":"http://uat.multimediarepository.testing.amadeus.com/cmr/retrieve/hotel/005298288C084E10B8C2F6C1D34F0507","category":"EXTERIOR"}]},"available":true,"offers":[{"id":"PU94IXXY0N","checkInDate":"2021-04-26","checkOutDate":"2021-04-27","rateCode":"S9R","rateFamilyEstimated":{"code":"SRS","type":"C"},"room":{"type":"XMI","typeEstimated":{"category":"STANDARD_ROOM","beds":1,"bedType":"SINGLE"},"description":{"text":"Marriott Senior Discount, includes 62 years and older valid ID \n2 Twin/Single Bed(s), Wireless internet, compli\nmentary, Coffee/tea maker, TV"}},"guests":{"adults":1},"price":{"currency":"EUR","base":"110.50","total":"121.55","variations":{"average":{"base":"110.50"},"changes":[{"startDate":"2021-04-26","endDate":"2021-04-27","base":"110.50"}]}},"policies":{"paymentType":"guarantee","cancellation":{"deadline":"2021-04-25T23:59:00+02:00"}}}],"self":"https://test.api.amadeus.com/v2/shopping/hotel-offers/by-hotel?hotelId=ARMADATO"}],"meta":{"links":{"next":"https://test.api.amadeus.com/v2/shopping/hotel-offers?cityCode=MAD&page[offset]=V34PGPO0DCJA_100"}}}

问题出在您定义的模型中。基于 JSON,您的模型将是:

public class HotelDistance
{
    public double distance { get; set; }
    public string distanceUnit { get; set; }
}

public class Address
{
    public List<string> lines { get; set; }
    public string postalCode { get; set; }
    public string cityName { get; set; }
    public string countryCode { get; set; }
}

public class Contact
{
    public string phone { get; set; }
    public string fax { get; set; }
    public string email { get; set; }
}

public class Description
{
    public string lang { get; set; }
    public string text { get; set; }
}

public class Medium
{
    public string uri { get; set; }
    public string category { get; set; }
}

public class Hotel
{
    public string type { get; set; }
    public string hotelId { get; set; }
    public string chainCode { get; set; }
    public string dupeId { get; set; }
    public string name { get; set; }
    public string rating { get; set; }
    public string cityCode { get; set; }
    public double latitude { get; set; }
    public double longitude { get; set; }
    public HotelDistance hotelDistance { get; set; }
    public Address address { get; set; }
    public Contact contact { get; set; }
    public Description description { get; set; }
    public List<string> amenities { get; set; }
    public List<Medium> media { get; set; }
}

public class RateFamilyEstimated
{
    public string code { get; set; }
    public string type { get; set; }
}

public class TypeEstimated
{
    public string category { get; set; }
    public int beds { get; set; }
    public string bedType { get; set; }
}

public class Room
{
    public string type { get; set; }
    public TypeEstimated typeEstimated { get; set; }
    public Description description { get; set; }
}

public class Guests
{
    public int adults { get; set; }
}

public class Average
{
    public string @base { get; set; }
}

public class Change
{
    public string startDate { get; set; }
    public string endDate { get; set; }
    public string @base { get; set; }
    public string total { get; set; }
}

public class Variations
{
    public Average average { get; set; }
    public List<Change> changes { get; set; }
}

public class Price
{
    public string currency { get; set; }
    public string @base { get; set; }
    public string total { get; set; }
    public Variations variations { get; set; }
}

public class AcceptedPayments
{
    public List<string> creditCards { get; set; }
    public List<string> methods { get; set; }
}

public class Guarantee
{
    public AcceptedPayments acceptedPayments { get; set; }
}

public class Cancellation
{
    public int numberOfNights { get; set; }
    public DateTime deadline { get; set; }
}

public class HoldTime
{
    public DateTime deadline { get; set; }
}

public class Policies
{
    public Guarantee guarantee { get; set; }
    public string paymentType { get; set; }
    public Cancellation cancellation { get; set; }
    public HoldTime holdTime { get; set; }
}

public class Commission
{
    public string amount { get; set; }
    public string percentage { get; set; }
}

public class Offer
{
    public string id { get; set; }
    public string checkInDate { get; set; }
    public string checkOutDate { get; set; }
    public string rateCode { get; set; }
    public RateFamilyEstimated rateFamilyEstimated { get; set; }
    public Room room { get; set; }
    public Guests guests { get; set; }
    public Price price { get; set; }
    public Policies policies { get; set; }
    public Commission commission { get; set; }
}

public class Datum
{
    public string type { get; set; }
    public Hotel hotel { get; set; }
    public bool available { get; set; }
    public List<Offer> offers { get; set; }
    public string self { get; set; }
}

public class Links
{
    public string next { get; set; }
}

public class Meta
{
    public Links links { get; set; }
}

public class Root
{
    public List<Datum> data { get; set; }
    public Meta meta { get; set; }
}

并且在控制器中,您应该像这样反序列化您的 JSON:

var result = JsonConvert.DeserializeObject<Root>(json);

PS- 用于将 JSON 转换为 C# 模型 -> https://json2csharp.com/ 用于验证 JSON-> https://jsonlint.com/