i have json string like this.
{
"pax": {
"children_ages": [
7,
0
],
"adult_quantity": 2
},
"room_category": "Standard",
"room_description": "FAMILY ROOM STANDARD",
"nightly_prices": {
"2017-08-17": "217.81",
"2017-08-18": "217.81",
"2017-08-19": "217.81",
"2017-08-20": "217.81",
"2017-08-21": "217.81",
"2017-08-22": "217.78"
},
"room_type": "DB"
}
after i create c# classes from it ,i can get following kind of classes set.
public class Pax
{
public List<int> children_ages { get; set; }
public int adult_quantity { get; set; }
}
public class NightlyPrices
{
public string __invalid_name__2017-08-17 { get; set; }
public string __invalid_name__2017-08-18 { get; set; }
public string __invalid_name__2017-08-19 { get; set; }
public string __invalid_name__2017-08-20 { get; set; }
public string __invalid_name__2017-08-21 { get; set; }
public string __invalid_name__2017-08-22 { get; set; }
}
public class RootObject
{
public Pax pax { get; set; }
public string room_category { get; set; }
public string room_description { get; set; }
public NightlyPrices nightly_prices { get; set; }
public string room_type { get; set; }
}
but this night prices is dynamic one.
"nightly_prices": {
"2018-08-17": "217.81",
"2017-08-18": "217.81",
"2018-08-19": "217.81",
"2018-08-20": "217.81",
"2017-08-21": "217.81",
"2017-08-22": "217.78"
},
when response change then i cannot retrieve data for nightly_prices ,after deserializing process.
I already tried this by adding dictionary types also.but it doesn't work well.
Is there any different ways to handle this scenario?