如何为此json创建模型?
{"code":"1", "message":"OK","response": {"user":{"id":"124","usertype":"29","currenttime":"2013- 04-24T08:09:20.487+00:00","sessionid":"2bcf1c92-9b97-47d8-8995-b39cf7cbe2af"}}}
我写的:
public class BaseResponse
{
public bool success;
public String message;
}
public class CreateTaskResponse : BaseResponse
{
CreateTaskResponseData data = new CreateTaskResponseData();
public User getUser()
{
return data.getUser();
}
}
class CreateTaskResponseData
{
User user = new User();
public User getUser()
{
return user;
}
}
public class User
{
public int id;
public int usertype;
public string currenttime;
public string sessionid;
}
并解析:
CreateTaskResponse Login = SimpleDataSerializer.ToObject<CreateTaskResponse>(response);
错误:Login.getUser().sessionid 为空