Q:

JSON Parse Bank Holiday Calendar

I have a ASP MVC project that is accessing an API to get bank holiday dates: https://www.gov.uk/bank-holidays.json
When I parse the JSON however I am getting problems when I try to get down to the level of the 'events'.  Currently I have:
var json = new WebClient().DownloadString("https://www.gov.uk/bank-holidays.json");
JavaScriptSerializer serializer = new JavaScriptSerializer();
var test = serializer. Deserialize<Dictionary<string, Dictionary<string, object>>>(json);

I can't seem to be able to cast the final object in this deserializer to anything meaningful.  I have tried a variety of objects, lists, arrays etc but nothing seem to work.  I only ever seem to be able to cast it to object. 
Ideally I'd like the JSON to be parsed to a meaningful object such as:
public class BankHoliday
{
  public DateTime Date { get; set; }
  public string Title { get; set; }
  public Country CountryCode { get; set; }
  public string Notes { get; set; }
  public bool Bunting { get; set; }
}

public enum Country
{
  EnglandWales,
  Scotland,
  NorthernIreland
}

I thought this would be fairly simple but I have tried everything.  I'm sure it's something simple that I am missing. 
Thanks

A:

Don't use JavaScriptSerializer better choice is JSON.NET
On site json2csharp.com you can generate classes from JSON:
public class Event
{
    public string title { get; set; }
    public string date { get; set; }
    public string notes { get; set; }
    public bool bunting { get; set; }
}

public class EnglandAndWales
{
    public string division { get; set; }
    public List<Event> events { get; set; }
}

public class Scotland
{
    public string division { get; set; }
    public List<Event> events { get; set; }
}

public class NorthernIreland
{
    public string division { get; set; }
    public List<Event> events { get; set; }
}

public class RootObject
{
    [JsonProperty(PropertyName = "england-and-wales")]
    public EnglandAndWales EnglandAndWales { get; set; }
    public Scotland scotland { get; set; }
    [JsonProperty(PropertyName = "northern-ireland")]
    public NorthernIreland NorthernIreland { get; set; }
}

And then deserialise it with this way:
RootObject rootObject = JsonConvert. DeserializeObject<RootObject>(output);

EDIT
Added properties in RootObject to handele bad names. 
Tested on simplified JSON:
{
    "england-and-wales": {
        "division": "england-and-wales",
        "events": [{
            "title": "New Year’s Day",
            "date": "2012-01-02",
            "notes": "Substitute day",
            "bunting": true
        },
        {
            "title": "Good Friday",
            "date": "2012-04-06",
            "notes": "",
            "bunting": false
        },          
        {
            "title": "Boxing Day",
            "date": "2017-12-26",
            "notes": "",
            "bunting": true
        }]
    },
    "scotland": {
        "division": "scotland",
        "events": [{
            "title": "2nd January",
            "date": "2012-01-02",
            "notes": "",
            "bunting": true
        },
        {
            "title": "New Year’s Day",
            "date": "2012-01-03",
            "notes": "Substitute day",
            "bunting": true
        },                  
        {
            "title": "Boxing Day",
            "date": "2017-12-26",
            "notes": "",
            "bunting": true
        }]
    },
    "northern-ireland": {
        "division": "northern-ireland",
        "events": [{
            "title": "New Year’s Day",
            "date": "2012-01-02",
            "notes": "Substitute day",
            "bunting": true
        },
        {
            "title": "St Patrick’s Day",
            "date": "2012-03-19",
            "notes": "Substitute day",
            "bunting": true
        },      
        {
            "title": "Boxing Day",
            "date": "2017-12-26",
            "notes": "",
            "bunting": true
        }]
    }
}

