C# 反序列化JSON windows phone 8时出错
我得到了一个返回JSON代码的api:C# 反序列化JSON windows phone 8时出错,c#,json,windows-phone-8,C#,Json,Windows Phone 8,我得到了一个返回JSON代码的api: [{"startDate":1409553000000, "endDate":1409570100000, "moduleCode":"#SPLUS0EBB2C", "activityDescription":"User Interface Design (Tjuna)","staffMembers":[], "locations":[{"id":"E404A902125255D3330455204193CC29","name":
[{"startDate":1409553000000,
"endDate":1409570100000,
"moduleCode":"#SPLUS0EBB2C",
"activityDescription":"User Interface Design (Tjuna)","staffMembers":[],
"locations":[{"id":"E404A902125255D3330455204193CC29","name":"HAA-H1-21","key":"14124","capacity":24,"url":null,"avoidConcurrencyLocationIds":[]}],
"studentSets":["INF3s","INF4a"],
"activityTypeName":"Other","activityTypeDescription":null,"notes":null,"highlighted":false,
"timetableKeys":["2013!studentsetgroup!9EEA55042B995043A2BC5739BF428E07"]}]
要反序列化,我有以下代码:
var responseObject = await JsonConvert.DeserializeObjectAsync<Apicalls.Rooster>(json);
class Rooster
{
public string startDate { get; set; }
public string endDate { get; set; }
public string activityDescription { get; set; }
public locations[] locations { get; set; }
public string studentSets { get; set; }
}
public class locations
{
public string name { get; set; }
}
var responseObject=await JsonConvert.DeserializeObjectAsync(json);
公鸡
{
公共字符串startDate{get;set;}
公共字符串endDate{get;set;}
公共字符串activityDescription{get;set;}
公共位置[]位置{get;set;}
公共字符串studentSets{get;set;}
}
公共课地点
{
公共字符串名称{get;set;}
}
每次尝试反序列化时,都会出现一个错误,即无法反序列化json代码。有人能帮我解决这个问题吗?Rooster
public class Rooster
{
public long startDate { get; set; }
public long endDate { get; set; }
public string moduleCode { get; set; }
public string activityDescription { get; set; }
public List<object> staffMembers { get; set; }
public List<Location> locations { get; set; }
public List<string> studentSets { get; set; }
public string activityTypeName { get; set; }
public object activityTypeDescription { get; set; }
public object notes { get; set; }
public bool highlighted { get; set; }
public List<string> timetableKeys { get; set; }
}
公鸡
{
公共长起始日期{get;set;}
公共长结束日期{get;set;}
公共字符串模块代码{get;set;}
公共字符串activityDescription{get;set;}
公共列表staffMembers{get;set;}
公共列表位置{get;set;}
公共列表studentSets{get;set;}
公共字符串activityTypeName{get;set;}
公共对象activityTypeDescription{get;set;}
公共对象注释{get;set;}
公共布尔突出显示{get;set;}
公共列表timetableKeys{get;set;}
}
位置
public class Location
{
public string id { get; set; }
public string name { get; set; }
public string key { get; set; }
public int capacity { get; set; }
public object url { get; set; }
public List<object> avoidConcurrencyLocationIds { get; set; }
}
公共类位置
{
公共字符串id{get;set;}
公共字符串名称{get;set;}
公共字符串密钥{get;set;}
公共整数容量{get;set;}
公共对象url{get;set;}
公共列表AvoidConcurrencyLocationId{get;set;}
}
代码:
var responseObject =
await JsonConvert.DeserializeObjectAsync<List<Apicalls.Rooster>>(json);
var响应对象=
等待JsonConvert.DeserializeObjectAsyncRooster
public class Rooster
{
public long startDate { get; set; }
public long endDate { get; set; }
public string moduleCode { get; set; }
public string activityDescription { get; set; }
public List<object> staffMembers { get; set; }
public List<Location> locations { get; set; }
public List<string> studentSets { get; set; }
public string activityTypeName { get; set; }
public object activityTypeDescription { get; set; }
public object notes { get; set; }
public bool highlighted { get; set; }
public List<string> timetableKeys { get; set; }
}
公鸡
{
公共长起始日期{get;set;}
公共长结束日期{get;set;}
公共字符串模块代码{get;set;}
公共字符串activityDescription{get;set;}
公共列表staffMembers{get;set;}
公共列表位置{get;set;}
公共列表studentSets{get;set;}
公共字符串activityTypeName{get;set;}
公共对象activityTypeDescription{get;set;}
公共对象注释{get;set;}
公共布尔突出显示{get;set;}
公共列表timetableKeys{get;set;}
}
位置
public class Location
{
public string id { get; set; }
public string name { get; set; }
public string key { get; set; }
public int capacity { get; set; }
public object url { get; set; }
public List<object> avoidConcurrencyLocationIds { get; set; }
}
公共类位置
{
公共字符串id{get;set;}
公共字符串名称{get;set;}
公共字符串密钥{get;set;}
公共整数容量{get;set;}
公共对象url{get;set;}
公共列表AvoidConcurrencyLocationId{get;set;}
}
代码:
var responseObject =
await JsonConvert.DeserializeObjectAsync<List<Apicalls.Rooster>>(json);
var响应对象=
等待JsonConvert.DeserializeObjectAsyncRooster
public class Rooster
{
public long startDate { get; set; }
public long endDate { get; set; }
public string moduleCode { get; set; }
public string activityDescription { get; set; }
public List<object> staffMembers { get; set; }
public List<Location> locations { get; set; }
public List<string> studentSets { get; set; }
public string activityTypeName { get; set; }
public object activityTypeDescription { get; set; }
public object notes { get; set; }
public bool highlighted { get; set; }
public List<string> timetableKeys { get; set; }
}
公鸡
{
公共长起始日期{get;set;}
公共长结束日期{get;set;}
公共字符串模块代码{get;set;}
公共字符串activityDescription{get;set;}
公共列表staffMembers{get;set;}
公共列表位置{get;set;}
公共列表studentSets{get;set;}
公共字符串activityTypeName{get;set;}
公共对象activityTypeDescription{get;set;}
公共对象注释{get;set;}
公共布尔突出显示{get;set;}
公共列表timetableKeys{get;set;}
}
位置
public class Location
{
public string id { get; set; }
public string name { get; set; }
public string key { get; set; }
public int capacity { get; set; }
public object url { get; set; }
public List<object> avoidConcurrencyLocationIds { get; set; }
}
公共类位置
{
公共字符串id{get;set;}
公共字符串名称{get;set;}
公共字符串密钥{get;set;}
公共整数容量{get;set;}
公共对象url{get;set;}
公共列表AvoidConcurrencyLocationId{get;set;}
}
代码:
var responseObject =
await JsonConvert.DeserializeObjectAsync<List<Apicalls.Rooster>>(json);
var响应对象=
等待JsonConvert.DeserializeObjectAsyncRooster
public class Rooster
{
public long startDate { get; set; }
public long endDate { get; set; }
public string moduleCode { get; set; }
public string activityDescription { get; set; }
public List<object> staffMembers { get; set; }
public List<Location> locations { get; set; }
public List<string> studentSets { get; set; }
public string activityTypeName { get; set; }
public object activityTypeDescription { get; set; }
public object notes { get; set; }
public bool highlighted { get; set; }
public List<string> timetableKeys { get; set; }
}
公鸡
{
公共长起始日期{get;set;}
公共长结束日期{get;set;}
公共字符串模块代码{get;set;}
公共字符串activityDescription{get;set;}
公共列表staffMembers{get;set;}
公共列表位置{get;set;}
公共列表studentSets{get;set;}
公共字符串activityTypeName{get;set;}
公共对象activityTypeDescription{get;set;}
公共对象注释{get;set;}
公共布尔突出显示{get;set;}
公共列表timetableKeys{get;set;}
}
位置
public class Location
{
public string id { get; set; }
public string name { get; set; }
public string key { get; set; }
public int capacity { get; set; }
public object url { get; set; }
public List<object> avoidConcurrencyLocationIds { get; set; }
}
公共类位置
{
公共字符串id{get;set;}
公共字符串名称{get;set;}
公共字符串密钥{get;set;}
公共整数容量{get;set;}
公共对象url{get;set;}
公共列表AvoidConcurrencyLocationId{get;set;}
}
代码:
var responseObject =
await JsonConvert.DeserializeObjectAsync<List<Apicalls.Rooster>>(json);
var响应对象=
等待JsonConvert.DeserializeObjectAsync,下次可以转到生成JSON文档的属性类。下次可以转到生成JSON文档的属性类。下次可以转到生成JSON文档的属性类。下次可以转到生成JSON文档的属性类。