{
"code": 0,
"message": "success",
"expense": {
"account_name": "Printing and Stationery",
"paid_through_account_name": "Petty Cash"
}
}
这是我的 json 格式,我正在尝试使用以下类对其进行反序列化
[DataContract]
public class Expenses
{
[DataMember(Name = "code")]
public int Code { get; set; }
[DataMember(Name = "message")]
public string Message { get; set; }
[DataMember(Name = "expense")]
public Expense Expense { get; set; }
}
[DataContract]
public class Expense
{
[DataMember(Name = "account_name")]
public string Account_Name { get; set; }
[DataMember(Name = "paid_through_account_name")]
public int Paid_Through_Account_Name { get; set; }
}
我在以下代码的帮助下调用这个类
var myObjects = JsonConvert.DeserializeObject<Expenses>(json);
但是在执行上述行时,我总是收到一条错误消息,
An exception of type 'System.UnauthorizedAccessException' occurred in PhoneApp18.DLL but was not handled in user code
If there is a handler for this exception, the program may be safely continued.
帮我摆脱这个问题....