次の JSON があります。
"jsonrpc":"2.0",
"id":1,
"result":
{
"1375833600000":
{
"notifications":[],
"events":[],
"lectures":[],
"birthdays":[
{
"id":"BB390BEE-CCBE-4D42-849C-E5040D6FD12C",
"date":1375909200000,
"name":"Test test",
"previewPhoto":"https://link.com/public/photos/h66/BB390BEE-CCBE-4D42-849C-E5040D6FD12C.jpg"
}]
},
"1375833600001":
{
"notifications":[],
"events":[],
"lectures":[],
"birthdays":[
{
"id":"BB390BEE-CCBE-4D42-849C-E5040D6FD12C",
"date":1375909200000,
"name":"Test test",
"previewPhoto":"https://link.com/public/photos/h66/BB390BEE-CCBE-4D42-849C-E5040D6FD12C.jpg"
}]
},
結果の文字列プロパティに何を書くべきかわかりません:
class Schedule
{
[JsonProperty("jsonrpc")]
public string Jsonrpc { get; set; }
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("result")]
public Result Result { get; set; }
}
public class Result
{
How to handle this: "1375833600000"
"1375833600001"
}
Resultのような配列だとは思いますが、名前が違います
私はこれを試しました:
class Schedule
{
[JsonProperty("jsonrpc")]
public string Jsonrpc { get; set; }
[JsonProperty("id")]
public string Id { get; set; }
private List<Results> result = new List<Results>();
[JsonProperty("result")]
public List<Results> Result { get { return result; } }
}
public class Results
{
private List<Event> events = new List<Event>();
[JsonProperty("events")]
public List<Event> Events { get { return events; } }
private List<Birthday> birthdays = new List<Birthday>();
[JsonProperty("birthdays")]
public List<Birthday> Birthdays { get { return birthdays; } }
}
public class Event
{
[JsonProperty("id")]
public int Id { get; set; }
[JsonProperty("datetime")]
public long Datetime { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("link")]
public string Link { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("allDayEvent")]
public bool AllDayEvent { get; set; }
}
public class Birthday
{
[JsonProperty("id")]
public int Id { get; set; }
[JsonProperty("date")]
public long Date { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("previewPhoto")]
public string PreviewPhoto { get; set; }
}
しかし、それは失敗します