この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 が null です