Reputation: 5104
How to write a .net object for such a json data in c#? I don't know how to deal with startTime and endTime fields.
{
"webinarKey":5303085652037254656,
"subject":"Test+Webinar+One",
"description":"Test+Webinar+One+Description",
"organizerKey":73563532324,
"times":[{"startTime":"2011-04-26T17:00:00Z","endTime":"2011-04-26T18:00:00Z"}]
}
I want to build a .net object first, then I can use JavaScriptSerializer to Deserialize it into the .net object. Thanks in advance.
Upvotes: 3
Views: 150
Reputation: 156524
It looks like the "times" property should look like this:
public List<TimeRange> Times{get;set;}
... which uses a second class that looks like this:
public class TimeRange
{
public DateTime StartTime {get;set;}
public DateTime EndTime {get;set;}
}
Upvotes: 1