Hi,
Can someone help in explaining how to extract the nested object(s) "event" from the following JSON.
{"jsonrpc":"2.0","result":[{"event":{"id":"27060267","name":"Southampton v West Ham","countryCode":"GB","timezone":"Europe/London","openDate":"2013-09-15T15:00:00.000Z"},"marketCount":69},{"event":{"id ":"2022802","name":"Barclays Premier League","countryCode":"GB","timezone":"Europe/London","openDate":"2013-08-17T11:45:00.000Z"},"marketCount":22},{"event":{"id ":"27060265","name":"Stoke v Man City","countryCode":"GB","timezone":"Europe/London","openDate":"2013-09-14T14:00:00.000Z"},"marketCount":69}]}
In this example i'm after a list of events List<Event>
public class Event
{
public string id { get; set; }
public string name { get; set; }
public string countryCode { get; set; }
public string timezone { get; set; }
public string openDate { get; set; }
}
I originally used the JSON2Csharp conversion which gave me the classes ROOTOBJECTS and RESULT also which worked when i deserialised the lot, however because this is on of two calls the second class objects were not allowed to use the same names. So it got me thinking there must be a way to just extract the single elemets without the need for the other bits.
I am new to JSON and i'm still finding my feet but if you can help that wold be great.
Thanks.
Tony
Can someone help in explaining how to extract the nested object(s) "event" from the following JSON.
{"jsonrpc":"2.0","result":[{"event":{"id":"27060267","name":"Southampton v West Ham","countryCode":"GB","timezone":"Europe/London","openDate":"2013-09-15T15:00:00.000Z"},"marketCount":69},{"event":{"id ":"2022802","name":"Barclays Premier League","countryCode":"GB","timezone":"Europe/London","openDate":"2013-08-17T11:45:00.000Z"},"marketCount":22},{"event":{"id ":"27060265","name":"Stoke v Man City","countryCode":"GB","timezone":"Europe/London","openDate":"2013-09-14T14:00:00.000Z"},"marketCount":69}]}
In this example i'm after a list of events List<Event>
public class Event
{
public string id { get; set; }
public string name { get; set; }
public string countryCode { get; set; }
public string timezone { get; set; }
public string openDate { get; set; }
}
I originally used the JSON2Csharp conversion which gave me the classes ROOTOBJECTS and RESULT also which worked when i deserialised the lot, however because this is on of two calls the second class objects were not allowed to use the same names. So it got me thinking there must be a way to just extract the single elemets without the need for the other bits.
I am new to JSON and i'm still finding my feet but if you can help that wold be great.
Thanks.
Tony

